Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -336,11 +336,11 @@ 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":
|
343 |
-
"find_loc": "Birmingham, AL, USA", # Fixed location
|
344 |
"api_key": os.getenv("SERP_API")
|
345 |
}
|
346 |
|
@@ -364,8 +364,7 @@ def fetch_yelp_restaurants(term="Restaurant"):
|
|
364 |
|
365 |
|
366 |
def process_restaurant_query(query):
|
367 |
-
|
368 |
-
restaurant_info = fetch_yelp_restaurants(term=query)
|
369 |
formatted_info = format_restaurant_info(restaurant_info)
|
370 |
return formatted_info
|
371 |
|
@@ -373,6 +372,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)
|
@@ -1019,11 +1019,11 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
1019 |
# Handle retrieval mode change
|
1020 |
retrieval_mode.change(fn=handle_retrieval_mode_change, inputs=retrieval_mode, outputs=[choice, choice])
|
1021 |
|
1022 |
-
|
1023 |
# weather_output = gr.HTML(value=fetch_local_weather())
|
1024 |
# news_output = gr.HTML(value=fetch_local_news())
|
1025 |
# events_output = gr.HTML(value=fetch_local_events())
|
1026 |
-
|
1027 |
|
1028 |
|
1029 |
with gr.Column():
|
|
|
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", # Default to "Restaurant"
|
343 |
+
"find_loc": "Birmingham, AL, USA", # Fixed location
|
344 |
"api_key": os.getenv("SERP_API")
|
345 |
}
|
346 |
|
|
|
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)
|
369 |
return formatted_info
|
370 |
|
|
|
372 |
|
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)
|
|
|
1019 |
# Handle retrieval mode change
|
1020 |
retrieval_mode.change(fn=handle_retrieval_mode_change, inputs=retrieval_mode, outputs=[choice, choice])
|
1021 |
|
1022 |
+
with gr.Column():
|
1023 |
# weather_output = gr.HTML(value=fetch_local_weather())
|
1024 |
# news_output = gr.HTML(value=fetch_local_news())
|
1025 |
# events_output = gr.HTML(value=fetch_local_events())
|
1026 |
+
restaurant_output=gr.HTML(value=fetch_yelp_restaurants())
|
1027 |
|
1028 |
|
1029 |
with gr.Column():
|