Spaces:
Runtime error
Runtime error
Joachim M. Vis commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,7 +22,7 @@ def travel_search(city: str) -> str:
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def airport_time_diff(airport1: str, airport2: str) -> str:
|
| 25 |
-
"""Calculate time difference between two airports.
|
| 26 |
|
| 27 |
Args:
|
| 28 |
airport1: First airport (city or IATA code)
|
|
@@ -55,16 +55,27 @@ def airport_time_diff(airport1: str, airport2: str) -> str:
|
|
| 55 |
except Exception as e:
|
| 56 |
return 'UTC'
|
| 57 |
|
|
|
|
| 58 |
tz1 = get_airport_timezone(airport1)
|
| 59 |
tz2 = get_airport_timezone(airport2)
|
| 60 |
-
|
| 61 |
time1 = datetime.datetime.now(pytz.timezone(tz1))
|
| 62 |
time2 = datetime.datetime.now(pytz.timezone(tz2))
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
return f"""
|
| 65 |
Time Comparison:
|
| 66 |
🛫 {airport1}: {time1.strftime('%H:%M')} ({tz1})
|
| 67 |
🛬 {airport2}: {time2.strftime('%H:%M')} ({tz2})
|
|
|
|
|
|
|
|
|
|
| 68 |
"""
|
| 69 |
|
| 70 |
@tool
|
|
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def airport_time_diff(airport1: str, airport2: str) -> str:
|
| 25 |
+
"""Calculate time difference between two airports and show attractions at destination.
|
| 26 |
|
| 27 |
Args:
|
| 28 |
airport1: First airport (city or IATA code)
|
|
|
|
| 55 |
except Exception as e:
|
| 56 |
return 'UTC'
|
| 57 |
|
| 58 |
+
# Get timezones and current times
|
| 59 |
tz1 = get_airport_timezone(airport1)
|
| 60 |
tz2 = get_airport_timezone(airport2)
|
|
|
|
| 61 |
time1 = datetime.datetime.now(pytz.timezone(tz1))
|
| 62 |
time2 = datetime.datetime.now(pytz.timezone(tz2))
|
| 63 |
|
| 64 |
+
# Get destination city attractions
|
| 65 |
+
try:
|
| 66 |
+
# Extract city name from airport2 (remove 'airport' if present)
|
| 67 |
+
dest_city = airport2.lower().replace('airport', '').strip()
|
| 68 |
+
attractions = web_search(f"{dest_city} top tourist attractions highlights")
|
| 69 |
+
except Exception as e:
|
| 70 |
+
attractions = "Could not fetch attractions information."
|
| 71 |
+
|
| 72 |
return f"""
|
| 73 |
Time Comparison:
|
| 74 |
🛫 {airport1}: {time1.strftime('%H:%M')} ({tz1})
|
| 75 |
🛬 {airport2}: {time2.strftime('%H:%M')} ({tz2})
|
| 76 |
+
|
| 77 |
+
Popular Attractions at {airport2}:
|
| 78 |
+
{attractions}
|
| 79 |
"""
|
| 80 |
|
| 81 |
@tool
|