pratikshahp commited on
Commit
1c82651
·
verified ·
1 Parent(s): da08728

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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
- model = pipeline("text-generation", model="gpt2") # Replace with a recipe-specific model if available
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=150, num_return_sequences=3)
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 = []