Spaces:
Running
Running
Update tool.py
Browse files
tool.py
CHANGED
@@ -20,13 +20,13 @@ class SimpleTool(Tool):
|
|
20 |
|
21 |
gmaps = googlemaps.Client(os.getenv("GMAPS_API_KEY"))
|
22 |
|
23 |
-
if
|
24 |
-
|
25 |
try:
|
26 |
directions_result = gmaps.directions(
|
27 |
start_location,
|
28 |
destination_location,
|
29 |
-
mode=
|
30 |
departure_time=datetime(2025, 1, 6, 11, 0), # Start on a Monday morning
|
31 |
)
|
32 |
return directions_result[0]["legs"][0]["duration"]["text"]
|
|
|
20 |
|
21 |
gmaps = googlemaps.Client(os.getenv("GMAPS_API_KEY"))
|
22 |
|
23 |
+
if transportation_mode is None:
|
24 |
+
transportation_mode = "transit"
|
25 |
try:
|
26 |
directions_result = gmaps.directions(
|
27 |
start_location,
|
28 |
destination_location,
|
29 |
+
mode=transportation_mode,
|
30 |
departure_time=datetime(2025, 1, 6, 11, 0), # Start on a Monday morning
|
31 |
)
|
32 |
return directions_result[0]["legs"][0]["duration"]["text"]
|