Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,39 +10,32 @@ from Gradio_UI import GradioUI
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
-
def
|
| 14 |
-
"""A tool that takes a
|
| 15 |
-
to find
|
| 16 |
Args:
|
| 17 |
-
food: A string representing a
|
| 18 |
Returns:
|
| 19 |
-
A formatted string containing
|
| 20 |
"""
|
| 21 |
try:
|
| 22 |
search_tool = DuckDuckGoSearchTool() # Requires smolagents
|
| 23 |
-
query = f"
|
| 24 |
results = search_tool(query)
|
| 25 |
|
| 26 |
if results:
|
| 27 |
-
# You will need to extract
|
| 28 |
# For now, here are mock placeholders:
|
| 29 |
-
|
| 30 |
-
fat = "YY g"
|
| 31 |
-
carbs = "ZZ g"
|
| 32 |
-
protein = "WW g"
|
| 33 |
-
|
| 34 |
return (
|
| 35 |
-
f"
|
| 36 |
-
|
| 37 |
-
f" * Fat: {fat}\n"
|
| 38 |
-
f" * Carbs: {carbs}\n"
|
| 39 |
-
f" * Protein: {protein}"
|
| 40 |
)
|
| 41 |
else:
|
| 42 |
-
return f"Sorry, I couldn't find any
|
| 43 |
|
| 44 |
except Exception as e:
|
| 45 |
-
return f"Error fetching
|
| 46 |
|
| 47 |
'''
|
| 48 |
|
|
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
+
def name_poem(food: str) -> str:
|
| 14 |
+
"""A tool that takes a name as input and performs a web search
|
| 15 |
+
to find funny poems containts this name.
|
| 16 |
Args:
|
| 17 |
+
food: A string representing a name.
|
| 18 |
Returns:
|
| 19 |
+
A formatted string containing poem with this name
|
| 20 |
"""
|
| 21 |
try:
|
| 22 |
search_tool = DuckDuckGoSearchTool() # Requires smolagents
|
| 23 |
+
query = f"Poem with {name} "
|
| 24 |
results = search_tool(query)
|
| 25 |
|
| 26 |
if results:
|
| 27 |
+
# You will need to extract poem from the results.
|
| 28 |
# For now, here are mock placeholders:
|
| 29 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
return (
|
| 31 |
+
f"Poem for {name}:\n"
|
| 32 |
+
|
|
|
|
|
|
|
|
|
|
| 33 |
)
|
| 34 |
else:
|
| 35 |
+
return f"Sorry, I couldn't find any poem {name}."
|
| 36 |
|
| 37 |
except Exception as e:
|
| 38 |
+
return f"Error fetching poem for '{name}': {e}. Please check the spelling or try anothr"
|
| 39 |
|
| 40 |
'''
|
| 41 |
|