Pijush2023 commited on
Commit
eb0fa43
·
verified ·
1 Parent(s): a2f185e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -671,7 +671,7 @@ def update_images():
671
 
672
  def clear_state_and_textbox():
673
  conversational_memory.clear()
674
- return "", None
675
 
676
  with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
677
  with gr.Row():
@@ -692,7 +692,9 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
692
  location_output = gr.HTML()
693
  retriver_button.click(fn=add_message, inputs=[chatbot, chat_input], outputs=[chatbot, chat_input]).then(
694
  fn=bot, inputs=[chatbot, choice, tts_choice, state], outputs=[chatbot, gr.Audio(interactive=False, autoplay=True)], api_name="Ask_Retriever").then(
695
- fn=show_map_if_details, inputs=[chatbot, choice], outputs=[location_output, location_output], api_name="map_finder")
 
 
696
 
697
  bot_msg = chat_msg.then(bot, [chatbot, choice, tts_choice], [chatbot], api_name="generate_voice_response")
698
  bot_msg.then(lambda: gr.Textbox(value="", interactive=True, placeholder="Ask Radar!!!...", show_label=False), None, [chat_input])
@@ -701,8 +703,8 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
701
  clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
702
 
703
  audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
704
- # audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="voice_query_to_text")
705
- audio_input.start_streaming_fn(clear_state_and_textbox).stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="voice_query_to_text")
706
 
707
 
708
 
 
671
 
672
  def clear_state_and_textbox():
673
  conversational_memory.clear()
674
+ return gr.update(value="")
675
 
676
  with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
677
  with gr.Row():
 
692
  location_output = gr.HTML()
693
  retriver_button.click(fn=add_message, inputs=[chatbot, chat_input], outputs=[chatbot, chat_input]).then(
694
  fn=bot, inputs=[chatbot, choice, tts_choice, state], outputs=[chatbot, gr.Audio(interactive=False, autoplay=True)], api_name="Ask_Retriever").then(
695
+ fn=show_map_if_details, inputs=[chatbot, choice], outputs=[location_output, location_output], api_name="map_finder").then(
696
+ fn=clear_state_and_textbox, inputs=[], outputs=[chat_input]
697
+ )
698
 
699
  bot_msg = chat_msg.then(bot, [chatbot, choice, tts_choice], [chatbot], api_name="generate_voice_response")
700
  bot_msg.then(lambda: gr.Textbox(value="", interactive=True, placeholder="Ask Radar!!!...", show_label=False), None, [chat_input])
 
703
  clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
704
 
705
  audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
706
+ audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="voice_query_to_text")
707
+
708
 
709
 
710