Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
|
|
|
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
@@ -7,17 +9,22 @@ from tools.final_answer import FinalAnswerTool
|
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
-
#
|
11 |
@tool
|
12 |
-
def
|
13 |
-
|
14 |
-
"""A tool that does nothing yet
|
15 |
Args:
|
16 |
-
|
17 |
-
arg2: the second argument
|
18 |
"""
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
|
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
2 |
+
from googlesearch import search
|
3 |
+
from bs4 import BeautifulSoup
|
4 |
import datetime
|
5 |
import requests
|
6 |
import pytz
|
|
|
9 |
|
10 |
from Gradio_UI import GradioUI
|
11 |
|
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 fetches recipes off the web for you
|
|
|
16 |
Args:
|
17 |
+
food: the food that you want a recipe for
|
|
|
18 |
"""
|
19 |
+
try:
|
20 |
+
query = f"{food} recipe"
|
21 |
+
search_results = search(query, num_results=5)
|
22 |
+
|
23 |
+
for url in search_results:
|
24 |
+
if "allrecipes.com" in url:
|
25 |
+
print("Here's the top result:" + url)
|
26 |
|
27 |
+
# Tutorial tool that fetches the time in a timezone.
|
28 |
@tool
|
29 |
def get_current_time_in_timezone(timezone: str) -> str:
|
30 |
"""A tool that fetches the current local time in a specified timezone.
|