Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,13 +51,13 @@ def get_location_tool(ip: str): str
|
|
| 51 |
"""
|
| 52 |
|
| 53 |
response = DbIpCity.get(ip, api_key='free')
|
| 54 |
-
|
| 55 |
'city': response.city,
|
| 56 |
'region': response.region,
|
| 57 |
'country': response.country,
|
| 58 |
'latitude': response.latitude,
|
| 59 |
'longitude': response.longitude
|
| 60 |
-
|
| 61 |
|
| 62 |
ip_address = 'YOUR_IP_ADDRESS' # Replace with the actual IP address
|
| 63 |
location = get_location(ip_address)
|
|
@@ -73,14 +73,14 @@ def get_current_time_in_timezone(timezone: str): str
|
|
| 73 |
|
| 74 |
Returns: The current local time in the following format ("%Y-%m-%d %H:%M:%S")
|
| 75 |
"""
|
| 76 |
-
|
| 77 |
# Create timezone object
|
| 78 |
tz = pytz.timezone(timezone)
|
| 79 |
# Get current time in that timezone
|
| 80 |
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 81 |
return f"The current local time in {timezone} is: {local_time}"
|
| 82 |
except Exception as e:
|
| 83 |
-
|
| 84 |
|
| 85 |
|
| 86 |
final_answer = FinalAnswerTool()
|
|
@@ -129,7 +129,7 @@ def hotel_recommendation_tool(city: str,price: str): str
|
|
| 129 |
Returns: A hotel name in a particular city with its pricing, and rating information
|
| 130 |
"""
|
| 131 |
|
| 132 |
-
|
| 133 |
response=ur.request.urlopen('https://foursquare.com/explore?mode=url&near='+city+'&price='+price+'&q=Resturant')
|
| 134 |
else:
|
| 135 |
response=ur.request.urlopen('https://foursquare.com/explore?mode=url&near='+city+'&q=Resturant')
|
|
@@ -166,7 +166,7 @@ def hotel_recommendation_tool(city: str,price: str): str
|
|
| 166 |
for i in range(0,len(name1)):
|
| 167 |
name_rate.append((name1[i],rate1[i]))
|
| 168 |
|
| 169 |
-
|
| 170 |
|
| 171 |
|
| 172 |
|
|
|
|
| 51 |
"""
|
| 52 |
|
| 53 |
response = DbIpCity.get(ip, api_key='free')
|
| 54 |
+
return {
|
| 55 |
'city': response.city,
|
| 56 |
'region': response.region,
|
| 57 |
'country': response.country,
|
| 58 |
'latitude': response.latitude,
|
| 59 |
'longitude': response.longitude
|
| 60 |
+
}
|
| 61 |
|
| 62 |
ip_address = 'YOUR_IP_ADDRESS' # Replace with the actual IP address
|
| 63 |
location = get_location(ip_address)
|
|
|
|
| 73 |
|
| 74 |
Returns: The current local time in the following format ("%Y-%m-%d %H:%M:%S")
|
| 75 |
"""
|
| 76 |
+
try:
|
| 77 |
# Create timezone object
|
| 78 |
tz = pytz.timezone(timezone)
|
| 79 |
# Get current time in that timezone
|
| 80 |
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 81 |
return f"The current local time in {timezone} is: {local_time}"
|
| 82 |
except Exception as e:
|
| 83 |
+
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 84 |
|
| 85 |
|
| 86 |
final_answer = FinalAnswerTool()
|
|
|
|
| 129 |
Returns: A hotel name in a particular city with its pricing, and rating information
|
| 130 |
"""
|
| 131 |
|
| 132 |
+
if(price!="-"):
|
| 133 |
response=ur.request.urlopen('https://foursquare.com/explore?mode=url&near='+city+'&price='+price+'&q=Resturant')
|
| 134 |
else:
|
| 135 |
response=ur.request.urlopen('https://foursquare.com/explore?mode=url&near='+city+'&q=Resturant')
|
|
|
|
| 166 |
for i in range(0,len(name1)):
|
| 167 |
name_rate.append((name1[i],rate1[i]))
|
| 168 |
|
| 169 |
+
return name_rate
|
| 170 |
|
| 171 |
|
| 172 |
|