Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,18 +9,24 @@ from Gradio_UI import GradioUI
|
|
9 |
|
10 |
|
11 |
@tool
|
12 |
-
def get_geolocation(city:str)-> str:
|
13 |
"""A tool that fetches the geo location of the city (e.g., "latitude":40.71427,"longitude":-74.00597)
|
14 |
Args:
|
15 |
city: A string representing a valid city (e.g., New York)
|
16 |
"""
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
@tool
|
26 |
def get_current_time_in_timezone(timezone: str) -> str:
|
@@ -60,7 +66,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
60 |
|
61 |
agent = CodeAgent(
|
62 |
model=model,
|
63 |
-
tools=[final_answer,
|
64 |
max_steps=6,
|
65 |
verbosity_level=1,
|
66 |
grammar=None,
|
|
|
9 |
|
10 |
|
11 |
@tool
|
12 |
+
"""def get_geolocation(city:str)-> str:
|
13 |
"""A tool that fetches the geo location of the city (e.g., "latitude":40.71427,"longitude":-74.00597)
|
14 |
Args:
|
15 |
city: A string representing a valid city (e.g., New York)
|
16 |
"""
|
17 |
+
Try:"""
|
18 |
+
|
19 |
+
@tool
|
20 |
+
def model_download_tool(task: str) -> str:
|
21 |
+
"""This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub.
|
22 |
+
It returns the name of the checkpoint.
|
23 |
+
|
24 |
+
Args:
|
25 |
+
task: The task for which to get the download count.
|
26 |
+
"""
|
27 |
+
most_downloaded_model = next(iter(list_models(filter=task, sort="download", direction=-1)))
|
28 |
+
|
29 |
+
return most_downloaded_model.id
|
30 |
|
31 |
@tool
|
32 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
66 |
|
67 |
agent = CodeAgent(
|
68 |
model=model,
|
69 |
+
tools=[final_answer,most_downloaded_model], ## add your tools here (don't remove final answer)
|
70 |
max_steps=6,
|
71 |
verbosity_level=1,
|
72 |
grammar=None,
|