Pijush2023 commited on
Commit
090cf7d
·
verified ·
1 Parent(s): abdd0da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
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(term="restaurant"):
340
  params = {
341
  "engine": "yelp",
342
  "find_desc": term,
343
- "find_loc": location,
344
  "api_key": os.getenv("SERP_API")
345
  }
346
 
@@ -362,15 +362,17 @@ def fetch_yelp_restaurants(term="restaurant"):
362
  yelp_data.append(restaurant_info)
363
  return yelp_data
364
 
 
365
  def process_restaurant_query(query):
366
- location = "Birmingham, AL, USA" # Default location or dynamically extracted from the query
367
- restaurant_info = fetch_yelp_restaurants(location=location, term=query)
368
  formatted_info = format_restaurant_info(restaurant_info)
369
  return formatted_info
370
 
371
 
372
 
373
 
 
374
  def add_message(history, message):
375
  history.append((message, None))
376
  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 fetch_yelp_restaurants(term="Restaurant"):
340
  params = {
341
  "engine": "yelp",
342
  "find_desc": term,
343
+ "find_loc": "Birmingham, AL, USA", # Fixed location for Birmingham
344
  "api_key": os.getenv("SERP_API")
345
  }
346
 
 
362
  yelp_data.append(restaurant_info)
363
  return yelp_data
364
 
365
+
366
  def process_restaurant_query(query):
367
+ # Call the function without the location argument
368
+ restaurant_info = fetch_yelp_restaurants(term=query)
369
  formatted_info = format_restaurant_info(restaurant_info)
370
  return formatted_info
371
 
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)