Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -33,14 +33,17 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
-
@tool
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
44 |
|
45 |
final_answer = FinalAnswerTool()
|
46 |
|
@@ -63,7 +66,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
63 |
|
64 |
agent = CodeAgent(
|
65 |
model=model,
|
66 |
-
tools=[final_answer,
|
67 |
max_steps=6,
|
68 |
verbosity_level=1,
|
69 |
grammar=None,
|
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
+
@tool
|
37 |
+
def get_weather(city):
|
38 |
+
import requests
|
39 |
+
url = f"https://www.accuweather.com/{city}"
|
40 |
+
response = requests.get(url)
|
41 |
+
if response.status_code == 200:
|
42 |
+
data = response.json()
|
43 |
+
return data.get("weather", "No weather information available")
|
44 |
+
else:
|
45 |
+
return "Error: Unable to fetch weather data."
|
46 |
+
|
47 |
|
48 |
final_answer = FinalAnswerTool()
|
49 |
|
|
|
66 |
|
67 |
agent = CodeAgent(
|
68 |
model=model,
|
69 |
+
tools=[final_answer,get_weather,image_generation_tool,get_current_time_in_timezone,DuckDuckGoSearchTool()], ## add your tools here (don't remove final answer)
|
70 |
max_steps=6,
|
71 |
verbosity_level=1,
|
72 |
grammar=None,
|