Spaces:
Runtime error
Runtime error
venkat-srinivasan-nexusflow
commited on
Commit
β’
d5968dd
1
Parent(s):
bba182a
Update tools.py
Browse files
tools.py
CHANGED
@@ -200,7 +200,17 @@ class Tools:
|
|
200 |
all_reviews = []
|
201 |
for place_name in place_names:
|
202 |
if isinstance(place_name, str):
|
203 |
-
if location:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
place_name += " , " + location
|
205 |
elif isinstance(place_name, dict) and "results" in place_name and "name" in place_name["results"]:
|
206 |
place_name = place_name["results"]["name"]
|
|
|
200 |
all_reviews = []
|
201 |
for place_name in place_names:
|
202 |
if isinstance(place_name, str):
|
203 |
+
if location and isinstance(location, list) and len(location) > 0:
|
204 |
+
# Sometimes location will be a list of relevant places from the API.
|
205 |
+
# We just use the first one.
|
206 |
+
location = location[0]
|
207 |
+
elif location and isinstance(location, list):
|
208 |
+
# No matching spaces found in the API, len of 0
|
209 |
+
location = None
|
210 |
+
if location and isinstance(location, dict):
|
211 |
+
# Weird response from the API, likely a timeout error, disable geoloc
|
212 |
+
location = None
|
213 |
+
if location and isinstance(location, str):
|
214 |
place_name += " , " + location
|
215 |
elif isinstance(place_name, dict) and "results" in place_name and "name" in place_name["results"]:
|
216 |
place_name = place_name["results"]["name"]
|