Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,20 +3,27 @@ import datetime
|
|
3 |
import requests
|
4 |
import pytz
|
5 |
import yaml
|
|
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
-
def
|
13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
14 |
-
"""A tool that
|
15 |
Args:
|
16 |
-
|
17 |
-
|
18 |
"""
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
@@ -51,7 +58,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
51 |
|
52 |
agent = CodeAgent(
|
53 |
model=model,
|
54 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
55 |
max_steps=6,
|
56 |
verbosity_level=1,
|
57 |
grammar=None,
|
|
|
3 |
import requests
|
4 |
import pytz
|
5 |
import yaml
|
6 |
+
import fastf1
|
7 |
from tools.final_answer import FinalAnswerTool
|
8 |
|
9 |
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 my_custom_tool(venue:str, year:int = 2024)-> str: #it's import to specify the return type
|
14 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
15 |
+
"""A tool that gets the winner for a given Formula1 race
|
16 |
Args:
|
17 |
+
venue: The name of the venue
|
18 |
+
year: The year. Defaults to 2024
|
19 |
"""
|
20 |
+
session = fastf1.get_session(year, venue, 'R')
|
21 |
+
session.load()
|
22 |
+
results = session.results
|
23 |
+
winner = results.query('Position'==1)['FullName']
|
24 |
+
return winner
|
25 |
+
|
26 |
+
|
27 |
|
28 |
@tool
|
29 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
58 |
|
59 |
agent = CodeAgent(
|
60 |
model=model,
|
61 |
+
tools=[final_answer, image_generation_tool, my_custom_tool], ## add your tools here (don't remove final answer)
|
62 |
max_steps=6,
|
63 |
verbosity_level=1,
|
64 |
grammar=None,
|