Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -336,10 +336,24 @@ def bot(history, choice, tts_choice, retrieval_mode):
|
|
336 |
history.append([response, None]) # Ensure the response is added in the correct format
|
337 |
|
338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
def fetch_yelp_restaurants():
|
340 |
params = {
|
341 |
"engine": "yelp",
|
342 |
-
"find_desc": "Restaurant",
|
343 |
"find_loc": "Birmingham, AL, USA", # Fixed location
|
344 |
"api_key": os.getenv("SERP_API")
|
345 |
}
|
@@ -362,7 +376,6 @@ def fetch_yelp_restaurants():
|
|
362 |
yelp_data.append(restaurant_info)
|
363 |
return yelp_data
|
364 |
|
365 |
-
|
366 |
def process_restaurant_query(query):
|
367 |
restaurant_info = fetch_yelp_restaurants() # No arguments passed now
|
368 |
formatted_info = format_restaurant_info(restaurant_info)
|
@@ -373,6 +386,7 @@ def process_restaurant_query(query):
|
|
373 |
|
374 |
|
375 |
|
|
|
376 |
def add_message(history, message):
|
377 |
history.append((message, None))
|
378 |
return history, gr.Textbox(value="", interactive=True, placeholder="Enter message or upload file...", show_label=False)
|
|
|
336 |
history.append([response, None]) # Ensure the response is added in the correct format
|
337 |
|
338 |
|
339 |
+
def format_restaurant_info(restaurant_info):
|
340 |
+
formatted_info = []
|
341 |
+
for restaurant in restaurant_info:
|
342 |
+
formatted_info.append(
|
343 |
+
f"**Name:** {restaurant['name']}\n"
|
344 |
+
f"**Rating:** {restaurant['rating']} stars\n"
|
345 |
+
f"**Reviews:** {restaurant['reviews']}\n"
|
346 |
+
f"**Phone:** {restaurant['phone']}\n"
|
347 |
+
f"**Snippet:** {restaurant['snippet']}\n"
|
348 |
+
f"**Services:** {restaurant['services']}\n"
|
349 |
+
f"**Yelp URL:** [Link]({restaurant['link']})\n"
|
350 |
+
)
|
351 |
+
return "\n\n".join(formatted_info)
|
352 |
+
|
353 |
def fetch_yelp_restaurants():
|
354 |
params = {
|
355 |
"engine": "yelp",
|
356 |
+
"find_desc": "Restaurant",
|
357 |
"find_loc": "Birmingham, AL, USA", # Fixed location
|
358 |
"api_key": os.getenv("SERP_API")
|
359 |
}
|
|
|
376 |
yelp_data.append(restaurant_info)
|
377 |
return yelp_data
|
378 |
|
|
|
379 |
def process_restaurant_query(query):
|
380 |
restaurant_info = fetch_yelp_restaurants() # No arguments passed now
|
381 |
formatted_info = format_restaurant_info(restaurant_info)
|
|
|
386 |
|
387 |
|
388 |
|
389 |
+
|
390 |
def add_message(history, message):
|
391 |
history.append((message, None))
|
392 |
return history, gr.Textbox(value="", interactive=True, placeholder="Enter message or upload file...", show_label=False)
|