Shreyas094 commited on
Commit
d597e1c
·
verified ·
1 Parent(s): 5fa63cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -271,8 +271,7 @@ with gr.Blocks() as demo:
271
  formatted_response = f"{main_content}\n\nSources:\n{sources}"
272
  else:
273
  print("Using PDF search")
274
- response = get_response_from_pdf(message, model, num_calls=num_calls, temperature=temperature, stop_clicked=stop_clicked)
275
- formatted_response = response
276
 
277
  print(f"Generated response: {formatted_response[:100]}...")
278
 
@@ -282,14 +281,13 @@ with gr.Blocks() as demo:
282
 
283
  is_generating = False
284
  print(f"Returning final response")
285
- return formatted_response, is_generating, stop_clicked
286
 
287
  def on_submit(message, history, use_web_search, model, temperature, num_calls, is_generating, stop_clicked):
288
  print(f"Submit button clicked with message: {message}")
289
- response, new_is_generating, new_stop_clicked = protected_generate_response(
290
  message, history, use_web_search, model, temperature, num_calls, is_generating, stop_clicked
291
  )
292
- new_history = history + [(message, response)]
293
  print(f"New history has {len(new_history)} items")
294
  return "", new_history, new_is_generating, new_stop_clicked
295
 
 
271
  formatted_response = f"{main_content}\n\nSources:\n{sources}"
272
  else:
273
  print("Using PDF search")
274
+ formatted_response = get_response_from_pdf(message, model, num_calls=num_calls, temperature=temperature, stop_clicked=stop_clicked)
 
275
 
276
  print(f"Generated response: {formatted_response[:100]}...")
277
 
 
281
 
282
  is_generating = False
283
  print(f"Returning final response")
284
+ return "", history + [(message, formatted_response)], is_generating, stop_clicked
285
 
286
  def on_submit(message, history, use_web_search, model, temperature, num_calls, is_generating, stop_clicked):
287
  print(f"Submit button clicked with message: {message}")
288
+ _, new_history, new_is_generating, new_stop_clicked = protected_generate_response(
289
  message, history, use_web_search, model, temperature, num_calls, is_generating, stop_clicked
290
  )
 
291
  print(f"New history has {len(new_history)} items")
292
  return "", new_history, new_is_generating, new_stop_clicked
293