umair894 commited on
Commit
c50b965
·
1 Parent(s): 35aeac6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -737,16 +737,17 @@ with gr.Blocks(title=title) as demo:
737
  print("Audio STOP")
738
  set_audio_playing(False)
739
 
740
- # with gr.Row():
741
- # sentence = gr.Textbox(visible=False)
742
- # audio = gr.Audio(
743
- # value=None,
744
- # label="Generated audio response",
745
- # streaming=True,
746
- # autoplay=True,
747
- # interactive=False,
748
- # show_label=True,
749
- # )
 
750
 
751
  audio.end(stop)
752
 
@@ -761,23 +762,22 @@ with gr.Blocks(title=title) as demo:
761
  )
762
 
763
  clear_btn = gr.ClearButton([chatbot, audio])
764
- #generate_speech,
765
  txt_msg = txt_btn.click(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
766
- [chatbot,chatbot_role], [chatbot,chatbot_role, sentence, audio]
767
  )
768
 
769
  txt_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)
770
- #generate_speech,
771
  txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
772
- [chatbot,chatbot_role], [chatbot,chatbot_role, sentence, audio]
773
  )
774
 
775
  txt_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)
776
- #generate_speech,
777
  file_msg = btn.stop_recording(
778
  add_file, [chatbot, btn], [chatbot, txt], queue=False
779
  ).then(
780
- [chatbot,chatbot_role], [chatbot,chatbot_role, sentence, audio]
781
  )
782
 
783
  file_msg.then(lambda: (gr.update(interactive=True),gr.update(interactive=True,value=None)), None, [txt, btn], queue=False)
 
737
  print("Audio STOP")
738
  set_audio_playing(False)
739
 
740
+ with gr.Row():
741
+ sentence = gr.Textbox(visible=False)
742
+ audio = gr.Audio(
743
+ value=None,
744
+ label="Generated audio response",
745
+ streaming=True,
746
+ autoplay=True,
747
+ interactive=False,
748
+ show_label=True,
749
+ visible=False,
750
+ )
751
 
752
  audio.end(stop)
753
 
 
762
  )
763
 
764
  clear_btn = gr.ClearButton([chatbot, audio])
 
765
  txt_msg = txt_btn.click(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
766
+ generate_speech, [chatbot,chatbot_role], [chatbot,chatbot_role, sentence, audio]
767
  )
768
 
769
  txt_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)
770
+
771
  txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
772
+ generate_speech, [chatbot,chatbot_role], [chatbot,chatbot_role, sentence, audio]
773
  )
774
 
775
  txt_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)
776
+
777
  file_msg = btn.stop_recording(
778
  add_file, [chatbot, btn], [chatbot, txt], queue=False
779
  ).then(
780
+ generate_speech, [chatbot,chatbot_role], [chatbot,chatbot_role, sentence, audio]
781
  )
782
 
783
  file_msg.then(lambda: (gr.update(interactive=True),gr.update(interactive=True,value=None)), None, [txt, btn], queue=False)