Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,13 +27,13 @@ from Gradio_UI import GradioUI
|
|
| 27 |
@tool
|
| 28 |
def get_current_time_in_timezone(timezone: str): str
|
| 29 |
|
| 30 |
-
"""A tool that fetches the current local time in a specified timezone.
|
| 31 |
Args:
|
| 32 |
timezone: A string representing a valid timezone (e.g., 'America/New_York')
|
| 33 |
|
| 34 |
Returns:
|
| 35 |
The current local time in the string format %Y-%m-%d %H:%M:%S (e.g., '2015-09-14 04:20:00')
|
| 36 |
-
"""
|
| 37 |
try:
|
| 38 |
# Create timezone object
|
| 39 |
tz = pytz.timezone(timezone)
|
|
@@ -61,13 +61,13 @@ model = HfApiModel(
|
|
| 61 |
@tool
|
| 62 |
def get_weather_data(city: str):
|
| 63 |
|
| 64 |
-
"""
|
| 65 |
Returns weather data for a given city.
|
| 66 |
Args:
|
| 67 |
city: The name of the city (e.g., New York, London, Tokyo)
|
| 68 |
Returns:
|
| 69 |
A dictionary containing weather data
|
| 70 |
-
"""
|
| 71 |
# Get weather for multiple cities
|
| 72 |
cities = ["Tokyo", "New York", "London"]
|
| 73 |
data = {}
|
|
@@ -86,7 +86,7 @@ def get_weather_data(city: str):
|
|
| 86 |
|
| 87 |
@tool
|
| 88 |
def hotel_recommendation_tool(city: str, price: str) -> str:
|
| 89 |
-
"""
|
| 90 |
This is a hotel recommendation tool that web scrapes foursquare.com and yelp.com for hotel ratings, user comments, and hotel information.
|
| 91 |
Args:
|
| 92 |
city: A string representing a valid city (e.g., 'Dubai, Singapore')
|
|
@@ -94,7 +94,7 @@ def hotel_recommendation_tool(city: str, price: str) -> str:
|
|
| 94 |
|
| 95 |
Returns:
|
| 96 |
A hotel name in a particular city with its pricing and rating information
|
| 97 |
-
"""
|
| 98 |
|
| 99 |
if price != "-":
|
| 100 |
response = ur.request.urlopen('https://foursquare.com/explore?mode=url&near=' + city + '&price=' + price + '&q=Resturant')
|
|
@@ -208,12 +208,12 @@ def get():
|
|
| 208 |
|
| 209 |
@tool
|
| 210 |
def SearchTool(DuckDuckGoSearchTool): query
|
| 211 |
-
"""
|
| 212 |
name = "web_search"
|
| 213 |
description = "Performs a web search for a query and returns a list of the top search results formatted as markdown with page titles and urls."
|
| 214 |
inputs = {"query": {"type": "string", "description": "The search query to perform."}}
|
| 215 |
output_type = "string"
|
| 216 |
-
"""
|
| 217 |
|
| 218 |
search_tool = DuckDuckGoSearchTool()
|
| 219 |
agent = CodeAgent(tools=[search_tool], model=model, add_base_tools=False, verbosity_level=2)
|
|
|
|
| 27 |
@tool
|
| 28 |
def get_current_time_in_timezone(timezone: str): str
|
| 29 |
|
| 30 |
+
"""A tool that fetches the current local time in a specified timezone.
|
| 31 |
Args:
|
| 32 |
timezone: A string representing a valid timezone (e.g., 'America/New_York')
|
| 33 |
|
| 34 |
Returns:
|
| 35 |
The current local time in the string format %Y-%m-%d %H:%M:%S (e.g., '2015-09-14 04:20:00')
|
| 36 |
+
"""
|
| 37 |
try:
|
| 38 |
# Create timezone object
|
| 39 |
tz = pytz.timezone(timezone)
|
|
|
|
| 61 |
@tool
|
| 62 |
def get_weather_data(city: str):
|
| 63 |
|
| 64 |
+
"""
|
| 65 |
Returns weather data for a given city.
|
| 66 |
Args:
|
| 67 |
city: The name of the city (e.g., New York, London, Tokyo)
|
| 68 |
Returns:
|
| 69 |
A dictionary containing weather data
|
| 70 |
+
"""
|
| 71 |
# Get weather for multiple cities
|
| 72 |
cities = ["Tokyo", "New York", "London"]
|
| 73 |
data = {}
|
|
|
|
| 86 |
|
| 87 |
@tool
|
| 88 |
def hotel_recommendation_tool(city: str, price: str) -> str:
|
| 89 |
+
"""
|
| 90 |
This is a hotel recommendation tool that web scrapes foursquare.com and yelp.com for hotel ratings, user comments, and hotel information.
|
| 91 |
Args:
|
| 92 |
city: A string representing a valid city (e.g., 'Dubai, Singapore')
|
|
|
|
| 94 |
|
| 95 |
Returns:
|
| 96 |
A hotel name in a particular city with its pricing and rating information
|
| 97 |
+
"""
|
| 98 |
|
| 99 |
if price != "-":
|
| 100 |
response = ur.request.urlopen('https://foursquare.com/explore?mode=url&near=' + city + '&price=' + price + '&q=Resturant')
|
|
|
|
| 208 |
|
| 209 |
@tool
|
| 210 |
def SearchTool(DuckDuckGoSearchTool): query
|
| 211 |
+
"""
|
| 212 |
name = "web_search"
|
| 213 |
description = "Performs a web search for a query and returns a list of the top search results formatted as markdown with page titles and urls."
|
| 214 |
inputs = {"query": {"type": "string", "description": "The search query to perform."}}
|
| 215 |
output_type = "string"
|
| 216 |
+
"""
|
| 217 |
|
| 218 |
search_tool = DuckDuckGoSearchTool()
|
| 219 |
agent = CodeAgent(tools=[search_tool], model=model, add_base_tools=False, verbosity_level=2)
|