|
--- |
|
license: bigscience-bloom-rail-1.0 |
|
tags: |
|
- bloom |
|
- text-generation |
|
- recipe-generation |
|
widget: |
|
- text: '{"prompt": ["onion", "pepper", "brown rice", "egg", "soy sauce"]' |
|
- text: '{"prompt": ["whole wheat flour", "berries", "baking powder", "milk"]' |
|
--- |
|
|
|
# Durban University of Technology Recipe Generator |
|
|
|
![image/png](img/dut.png) |
|
|
|
## Model Details |
|
|
|
### Description |
|
|
|
This model is a fine-tuned version of [bloom560m](https://huggingface.co./bigscience/bloom-560m) aimed at recipe generation for a given set of ingredients. |
|
Its focus is on the creation of healthier, diabetic-friendly recipes with the set of ingredients that someone has on |
|
hand. |
|
|
|
This model further differentiates itself by prioritising common kitchen measurements (e.g. 1 cup, 1 teaspoon) and the |
|
metric system (e.g. 500g, 100ml) over US customary or imperial measurement systems. |
|
|
|
During model training, unfamiliar recipes were tested by the Department of Food and Nutrition, with feedback incorporated to enhance the model's performance. |
|
|
|
|
|
![image/png](img/mosaic.jpg) |
|
|
|
### Usage Example |
|
```python |
|
import json |
|
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline |
|
|
|
tokenizer = AutoTokenizer.from_pretrained("Ashikan/dut-recipe-generator") |
|
model = AutoModelForCausalLM.from_pretrained("Ashikan/dut-recipe-generator") |
|
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer) |
|
|
|
input_ingredients = ["mushrooms", "cabbage", "soy sauce", "sesame seeds", "honey"] |
|
|
|
input_text = '{"prompt": ' + json.dumps(input_ingredients) |
|
|
|
output = pipe(input_text, max_length=1024, temperature=0.2, do_sample=True, truncation=True)[0]["generated_text"] |
|
|
|
#JSON formatted output with "title", "ingredients" and "method" nodes available |
|
print(output) |
|
``` |
|
|
|
### Application Example |
|
You may test out the model on HuggingFace spaces here: |
|
https://huggingface.co./spaces/Ashikan/dut-recipe-generator |
|
|
|
### Training Data |
|
This model was first trained on a heavily filtered and processed version of the existing [Recipe NLG](https://huggingface.co./datasets/mbien/recipe_nlg) dataset. |
|
Pre-processing involved the removal of invalid recipes, conversion of units such as degrees Fahrenheit to degrees Celsius and the filtering out of recipes completely written in US customary or imperial measurements. |
|
|
|
After the initial training, the model was then trained on a new recipe dataset written by the Durban University of Technology. |
|
This dataset was tailored to feature healthier, diabetic-friendly recipes with a focus on ease of preparation and nutritional content. |
|
These recipes can be found within the [Dut Diabetic Friendly Recipes](https://huggingface.co./datasets/Ashikan/diabetic-friendly-recipes) dataset. |
|
|
|
|
|
## Citation Information |
|
|
|
``` |
|
Prof Ashika Naicker*, Mr Shaylin Chetty, Ms Riashnie Thaver*, Ms. Anjellah Reddy*, Dr. Evonne Shanita Singh*, Dr. Imana Pal*, Dr. Lisebo Mothepu*. |
|
|
|
*Durban University of Technology, Faculty of Applied Sciences, Department of Food and Nutrition, Durban, South Africa |
|
|
|
``` |