Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,12 +2,13 @@ import gradio as gr
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
# Load a model from Hugging Face for recipe generation
|
| 5 |
-
|
| 6 |
-
|
|
|
|
| 7 |
# Recipe generation function
|
| 8 |
def suggest_recipes(ingredients):
|
| 9 |
prompt = f"Suggest some recipes using the following ingredients: {ingredients}. Include preparation time for each recipe."
|
| 10 |
-
response = model(prompt, max_length=
|
| 11 |
|
| 12 |
# Parse model output into a readable format
|
| 13 |
recipes = []
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
# Load a model from Hugging Face for recipe generation
|
| 5 |
+
# Use a pipeline as a high-level helper
|
| 6 |
+
from transformers import pipeline
|
| 7 |
+
model = pipeline("text2text-generation", model="flax-community/t5-recipe-generation")
|
| 8 |
# Recipe generation function
|
| 9 |
def suggest_recipes(ingredients):
|
| 10 |
prompt = f"Suggest some recipes using the following ingredients: {ingredients}. Include preparation time for each recipe."
|
| 11 |
+
response = model(prompt, max_length=500, num_return_sequences=3)
|
| 12 |
|
| 13 |
# Parse model output into a readable format
|
| 14 |
recipes = []
|