pratikshahp commited on
Commit
2450cde
·
verified ·
1 Parent(s): 80803ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -18,11 +18,15 @@ llm = HuggingFaceEndpoint(
18
  def suggest_recipes(ingredients):
19
  # Create a prompt for the recipe generation
20
  prompt = (
21
- f"You are an expert in cooking. Carefully review the provided ingredients: {ingredients}. "
22
- f"If ingredients are invalid (e.g., non-food items, questions or any random words ), respond only with a two-line polite apology for not being able to process the request & Please do not provide any recipes, alternative suggestions, or outputs in such cases. "
23
- f"If all ingredients are valid, suggest 2 recipes using them. Provide a title, preparation time, and step-by-step directions. "
24
- f"Do not include the ingredients list in the recipes."
25
- )
 
 
 
 
26
 
27
 
28
  # Use the HuggingFaceEndpoint model to generate a response
 
18
  def suggest_recipes(ingredients):
19
  # Create a prompt for the recipe generation
20
  prompt = (
21
+ f"You are a professional chef. Please evaluate the provided input: {ingredients}. "
22
+ f"If the input does not contain valid food ingredients (e.g., it includes non-food items, random text, or questions like 'What should I cook today?'), "
23
+ f"respond with exactly two lines apologizing for not being able to process the request. "
24
+ f"Do not provide recipes, suggestions, or any other information in such cases. "
25
+ f"If the input contains valid food ingredients, suggest exactly 2 recipes. For each recipe, provide: "
26
+ f"1) A title, 2) Preparation time, and 3) Clear, step-by-step instructions. "
27
+ f"Do not include the ingredient list in the response."
28
+ )
29
+
30
 
31
 
32
  # Use the HuggingFaceEndpoint model to generate a response