Spaces:
Build error
Build error
Create recipe_suggestions.py
Browse files- recipe_suggestions.py +17 -0
recipe_suggestions.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Recipe suggestions module
|
| 2 |
+
def get_recipe_suggestion(ingredients):
|
| 3 |
+
ingredient_list = ingredients.split(",")
|
| 4 |
+
|
| 5 |
+
# Here, you would ideally load a more complex model or recipe database.
|
| 6 |
+
recipes = {
|
| 7 |
+
"rice, milk, jaggery": "Kheer (Indian Rice Pudding)",
|
| 8 |
+
"tomato, onion, garlic, rice": "Tomato Rice",
|
| 9 |
+
"flour, sugar, butter": "Cookies"
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
# Search for a match in the recipe dictionary
|
| 13 |
+
for key, dish in recipes.items():
|
| 14 |
+
if all(ingredient.strip().lower() in ingredients.lower() for ingredient in key.split(',')):
|
| 15 |
+
return f"Suggested Dish: {dish}"
|
| 16 |
+
|
| 17 |
+
return "No dish found for these ingredients. Please try again!"
|