Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,18 +2,13 @@ import gradio as gr
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# Load a model from Hugging Face for recipe generation
|
5 |
-
model = pipeline("text-generation", model="
|
6 |
# Recipe generation function
|
7 |
def suggest_recipes(ingredients):
|
8 |
prompt = f"You are an expert in cooking. Please suggest 3 recipes using the following ingredients: {ingredients}. Provide a title for each recipe, include preparation time, and list step-by-step directions."
|
9 |
response = model(prompt)
|
10 |
-
|
11 |
-
|
12 |
-
recipes = []
|
13 |
-
for i, recipe in enumerate(response):
|
14 |
-
text = recipe["generated_text"]
|
15 |
-
|
16 |
-
return "\n\n".join(recipes)
|
17 |
|
18 |
# Gradio interface
|
19 |
with gr.Blocks() as app:
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# Load a model from Hugging Face for recipe generation
|
5 |
+
model = pipeline("text-generation", model="flax-community/t5-recipe-generation")
|
6 |
# Recipe generation function
|
7 |
def suggest_recipes(ingredients):
|
8 |
prompt = f"You are an expert in cooking. Please suggest 3 recipes using the following ingredients: {ingredients}. Provide a title for each recipe, include preparation time, and list step-by-step directions."
|
9 |
response = model(prompt)
|
10 |
+
return response
|
11 |
+
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Gradio interface
|
14 |
with gr.Blocks() as app:
|