Shreyas094 commited on
Commit
3cef93f
·
verified ·
1 Parent(s): ef735f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -665,13 +665,12 @@ def transcribe_and_respond(audio_file, history, model, temperature, num_calls, u
665
  logging.info(f"Query extracted from transcription: {query}")
666
 
667
  # Use the transcription as the query
668
- new_history = list(respond(query, history, model, temperature, num_calls, use_web_search, document_selector))
669
 
670
- logging.info(f"New history after response: {new_history}")
671
 
672
- # Ensure the query is properly displayed in the chat history
673
- if new_history and new_history[-1][0] != query:
674
- new_history[-1] = (query, new_history[-1][1])
675
 
676
  return new_history
677
 
@@ -772,7 +771,7 @@ with gr.Blocks() as demo:
772
  transcribe_button.click(
773
  transcribe_and_respond,
774
  inputs=[audio_input, chatbot, model, temperature, num_calls, use_web_search, document_selector],
775
- outputs=[chatbot]
776
  )
777
 
778
  submit_button.click(
 
665
  logging.info(f"Query extracted from transcription: {query}")
666
 
667
  # Use the transcription as the query
668
+ response = next(respond(query, history, model, temperature, num_calls, use_web_search, document_selector))
669
 
670
+ logging.info(f"Response: {response}")
671
 
672
+ # Update the history with the new query and response
673
+ new_history = history + [(query, response)]
 
674
 
675
  return new_history
676
 
 
771
  transcribe_button.click(
772
  transcribe_and_respond,
773
  inputs=[audio_input, chatbot, model, temperature, num_calls, use_web_search, document_selector],
774
+ outputs=chatbot
775
  )
776
 
777
  submit_button.click(