Files changed (1) hide show
  1. app.py +24 -8
app.py CHANGED
@@ -9,14 +9,30 @@ 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 my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
- #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that does nothing yet
15
- Args:
16
- arg1: the first argument
17
- arg2: the second argument
18
- """
19
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def get_tunisia_weather() -> dict:
13
+ """Fetches the current weather for all major cities in Tunisia."""
14
+ import requests
15
+
16
+ cities = ["Tunis", "Sfax", "Sousse", "Gabès", "Bizerte", "Nabeul", "Kairouan", "Gafsa", "Monastir", "Mahdia"]
17
+ api_key = "YOUR_API_KEY"
18
+ base_url = "http://api.openweathermap.org/data/2.5/weather"
19
+
20
+ weather_data = {}
21
+
22
+ for city in cities:
23
+ response = requests.get(base_url, params={"q": city + ",TN", "appid": api_key, "units": "metric"})
24
+ if response.status_code == 200:
25
+ data = response.json()
26
+ weather_data[city] = {
27
+ "temperature": data["main"]["temp"],
28
+ "humidity": data["main"]["humidity"],
29
+ "weather": data["weather"][0]["description"]
30
+ }
31
+ else:
32
+ weather_data[city] = "Weather data unavailable"
33
+
34
+ return weather_data
35
+
36
 
37
  @tool
38
  def get_current_time_in_timezone(timezone: str) -> str: