hashtags
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import requests
|
|
| 4 |
SPOONACULAR_API_KEY = "71259036cfb3405aa5d49c1220a988c5"
|
| 5 |
recipe_id_map = {}
|
| 6 |
|
| 7 |
-
#
|
| 8 |
def search_recipes(ingredient, cuisine, dietary):
|
| 9 |
global recipe_id_map
|
| 10 |
url = "https://api.spoonacular.com/recipes/complexSearch"
|
|
@@ -26,7 +26,7 @@ def search_recipes(ingredient, cuisine, dietary):
|
|
| 26 |
recipe_id_map = {r["title"]: r["id"] for r in data["results"]}
|
| 27 |
return gr.update(choices=list(recipe_id_map.keys()), visible=True, label="Select a recipe"), gr.update(value="Select a recipe from the dropdown above.")
|
| 28 |
|
| 29 |
-
#
|
| 30 |
def get_recipe_details(selected_title):
|
| 31 |
if not selected_title or selected_title not in recipe_id_map:
|
| 32 |
return "Please select a valid recipe."
|
|
|
|
| 4 |
SPOONACULAR_API_KEY = "71259036cfb3405aa5d49c1220a988c5"
|
| 5 |
recipe_id_map = {}
|
| 6 |
|
| 7 |
+
# search for recipes
|
| 8 |
def search_recipes(ingredient, cuisine, dietary):
|
| 9 |
global recipe_id_map
|
| 10 |
url = "https://api.spoonacular.com/recipes/complexSearch"
|
|
|
|
| 26 |
recipe_id_map = {r["title"]: r["id"] for r in data["results"]}
|
| 27 |
return gr.update(choices=list(recipe_id_map.keys()), visible=True, label="Select a recipe"), gr.update(value="Select a recipe from the dropdown above.")
|
| 28 |
|
| 29 |
+
# get recipe details
|
| 30 |
def get_recipe_details(selected_title):
|
| 31 |
if not selected_title or selected_title not in recipe_id_map:
|
| 32 |
return "Please select a valid recipe."
|