Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ from Gradio_UI import GradioUI
|
|
12 |
# Sous chef that will fetch recipes off the web for you, given a food.
|
13 |
@tool
|
14 |
def sous_chef(food:str)-> str: #it's import to specify the return type
|
15 |
-
"""A tool that
|
16 |
Args:
|
17 |
food: the food that you want a recipe for
|
18 |
"""
|
@@ -21,8 +21,23 @@ def sous_chef(food:str)-> str: #it's import to specify the return type
|
|
21 |
search_results = search(query, num_results=5)
|
22 |
|
23 |
for url in search_results:
|
24 |
-
if "
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
# Tutorial tool that fetches the time in a timezone.
|
28 |
@tool
|
|
|
12 |
# Sous chef that will fetch recipes off the web for you, given a food.
|
13 |
@tool
|
14 |
def sous_chef(food:str)-> str: #it's import to specify the return type
|
15 |
+
"""A tool that, given a recipe, will attempt to fetch a result off of well-known recipe sites.
|
16 |
Args:
|
17 |
food: the food that you want a recipe for
|
18 |
"""
|
|
|
21 |
search_results = search(query, num_results=5)
|
22 |
|
23 |
for url in search_results:
|
24 |
+
if f"seriouseats.com/search?q={food}" in url:
|
25 |
+
return f"Here's a result from Serious Eats: {url} "
|
26 |
+
elif f"allrecipes.com/?q={food}" in url:
|
27 |
+
return f"Here's a result from allrecipes.com: {url} "
|
28 |
+
elif f"pinchofyum.com/?s={food}" in url:
|
29 |
+
return f"Here's a result from Pinch of Yum: {url} "
|
30 |
+
elif f"budgetbytes.com/?s={food}" in url:
|
31 |
+
return f"Here's a result from Budget Bytes: {url} "
|
32 |
+
elif f"chefspencil.com/?s={food}" in url:
|
33 |
+
return f"Here's a result from Chef's Pencil: {url} "
|
34 |
+
else:
|
35 |
+
return "Could not find result on major platforms."
|
36 |
+
|
37 |
+
except Exception as e:
|
38 |
+
return f"Error fetching recipe for '{food}': {str(e)}"
|
39 |
+
|
40 |
+
|
41 |
|
42 |
# Tutorial tool that fetches the time in a timezone.
|
43 |
@tool
|