pratikshahp commited on
Commit
8b61222
·
verified ·
1 Parent(s): 59e3608

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
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="openai-community/gpt2-large")
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
- # Parse model output into a structured format
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: