
# chef-gpt-base
GPT-2 architecture trained to generate recipes based on ingredients. [Visit website](https://chef-gpt.streamlit.app/).

## Model description
This is GPT-2 pretrained on a custom dataset of recipies in Bulgarian.
You can find the dataset [here](https://www.kaggle.com/datasets/auhide/bulgarian-recipes-dataset).

## Usage
```python
import re
# Using this library to beautifully print the long recipe string.
from pprint import pprint

from transformers import AutoModelForCausalLM, AutoTokenizer


# Load the model and tokenizer:
MODEL_ID = "auhide/chef-gpt-base"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
chef_gpt = AutoModelForCausalLM.from_pretrained(MODEL_ID)

# Prepare the input:
ingredients = [
    "1 ч.ч. брашно",
    "4 яйца",
    "1 кофичка кисело мляко",
    "1/4 ч.л. сода",
]
input_text = f"[ING]{'[EOL]'.join(ingredients)}[REC]"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids

# Generate text:
output = chef_gpt.generate(input_ids, max_length=150)
recipe = tokenizer.batch_decode(output)[0]
# Get the generated recipe - it is up until the 1st [SEP] token.
recipe = re.findall(r"\[REC\](.+?)\[SEP\]", recipe)[0]

print("Съставки/Ingredients:")
pprint(ingredients)
print("\nРецепта/Recipe:")
pprint(recipe)
```
```bash
Съставки/Ingredients:
['1 ч.ч. брашно', '4 яйца', '1 кофичка кисело мляко', '1/4 ч.л. сода']

Рецепта/Recipe:
('В дълбока купа се разбиват яйцата. Добавя се киселото мляко, в което '
 'предварително е сложена содата, и се разбива. Добавя се брашното и се омесва '
 'тесто. Ако е много гъсто се добавя още малко брашно, ако е много гъсто се '
 'добавя още малко брашно. Фурната се загрява предварително на 180С градуса. '
 'Когато тестото е готово, се вади от фурната и се разделя на три части.')
```


## Additional tokens
- [ING] - ingredients token; denotes the begining of the tokens representing the ingredients
- [EOL] - end-of-line token; equivalent to a newline
- [REC] - recipe token; denotes the begining of the recipe
{"language": ["bg"], "license": "mit", "pipeline_tag": "text-generation", "widget": [{"text": "[ING]1 \u043a\u0430\u0440\u0442\u043e\u0444[REC]"}, {"text": "[ING]4 \u0431\u0440. \u044f\u0439\u0446\u0430[EOL]1 \u043a\u043e\u0444\u0438\u0447\u043a\u0430 \u043a\u0438\u0441\u0435\u043b\u043e \u043c\u043b\u044f\u043a\u043e[EOL]1/4 \u0447.\u043b. \u0441\u043e\u0434\u0430[REC]"}], "model-index": [{"name": "chef-gpt-base", "results": []}]}
transformers pytorch safetensors gpt2 text-generation bg license:mit autotrain_compatible endpoints_compatible text-generation-inference region:us
TAGS
#transformers #pytorch #safetensors #gpt2 #text-generation #bg #license-mit #autotrain_compatible #endpoints_compatible #text-generation-inference #region-us 


# chef-gpt-base
GPT-2 architecture trained to generate recipes based on ingredients. Visit website.

## Model description
This is GPT-2 pretrained on a custom dataset of recipies in Bulgarian.
You can find the dataset here.

## Usage




## Additional tokens
- [ING] - ingredients token; denotes the begining of the tokens representing the ingredients
- [EOL] - end-of-line token; equivalent to a newline
- [REC] - recipe token; denotes the begining of the recipe
# chef-gpt-base
GPT-2 architecture trained to generate recipes based on ingredients. Visit website. ## Model description
This is GPT-2 pretrained on a custom dataset of recipies in Bulgarian.
You can find the dataset here. ## Usage ## Additional tokens
- [ING] - ingredients token; denotes the begining of the tokens representing the ingredients
- [EOL] - end-of-line token; equivalent to a newline
- [REC] - recipe token; denotes the begining of the recipe
TAGS
#transformers #pytorch #safetensors #gpt2 #text-generation #bg #license-mit #autotrain_compatible #endpoints_compatible #text-generation-inference #region-us 
 # chef-gpt-base
GPT-2 architecture trained to generate recipes based on ingredients. Visit website. ## Model description
This is GPT-2 pretrained on a custom dataset of recipies in Bulgarian.
You can find the dataset here. ## Usage ## Additional tokens
- [ING] - ingredients token; denotes the begining of the tokens representing the ingredients
- [EOL] - end-of-line token; equivalent to a newline
- [REC] - recipe token; denotes the begining of the recipe
TAGS
#transformers #pytorch #safetensors #gpt2 #text-generation #bg #license-mit #autotrain_compatible #endpoints_compatible #text-generation-inference #region-us 
# chef-gpt-base
GPT-2 architecture trained to generate recipes based on ingredients. Visit website.## Model description
This is GPT-2 pretrained on a custom dataset of recipies in Bulgarian.
You can find the dataset here.## Usage## Additional tokens
- [ING] - ingredients token; denotes the begining of the tokens representing the ingredients
- [EOL] - end-of-line token; equivalent to a newline
- [REC] - recipe token; denotes the begining of the recipe