Spaces:
Sleeping
Sleeping
Update app.py
Browse filestool to get weather updates
app.py
CHANGED
|
@@ -19,6 +19,22 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 19 |
return "What magic will you build ?"
|
| 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.
|
| 24 |
Args:
|
|
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
@tool
|
| 22 |
+
def get_weather(city:str)-> str: #it's import to specify the return type
|
| 23 |
+
""" A tool to Fetch weather of a given city
|
| 24 |
+
Args:
|
| 25 |
+
city : name of the city (string)
|
| 26 |
+
returns: weather information of the City as string.
|
| 27 |
+
"""
|
| 28 |
+
if not city or city.strip() == "":
|
| 29 |
+
return "No Data Found"
|
| 30 |
+
|
| 31 |
+
url_https = f"https://wttr.in/{city}?format=3"
|
| 32 |
+
resp=requests.get(url_https)
|
| 33 |
+
if resp.status() == 200:
|
| 34 |
+
return resp
|
| 35 |
+
else:
|
| 36 |
+
return "No Data Found"
|
| 37 |
+
@tool
|
| 38 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 39 |
"""A tool that fetches the current local time in a specified timezone.
|
| 40 |
Args:
|