Spaces:
Runtime error
Runtime error
Commit
·
798f846
1
Parent(s):
ff0411d
improve HMI
Browse files
app.py
CHANGED
@@ -796,6 +796,13 @@ def playsound():
|
|
796 |
soundfilename = Filename_Chatbot
|
797 |
return soundfilename
|
798 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
799 |
with gr.Blocks() as demo:
|
800 |
# gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
|
801 |
# main = gr.ChatInterface(
|
@@ -816,8 +823,8 @@ with gr.Blocks() as demo:
|
|
816 |
placeholder = "Input Your Question",
|
817 |
show_label = False,
|
818 |
)
|
819 |
-
|
820 |
-
|
821 |
|
822 |
with gr.Row():
|
823 |
|
@@ -858,9 +865,14 @@ with gr.Blocks() as demo:
|
|
858 |
retry_button.click(retry, chatbot, chatbot)
|
859 |
inf1 = inputtext.submit(chathmi3, [inputtext, chatbot], [inputtext, chatbot]).\
|
860 |
then(playsound, None, voice_output)
|
|
|
|
|
|
|
|
|
861 |
# inf2 = inputtext.submit(display_input, [inputtext, chatbot], chatbot).\
|
862 |
# then(Inference_Agent, chatbot, [inputtext, chatbot])
|
863 |
-
stop_button.click(read_logs, None, logs, cancels=[inf1])
|
|
|
864 |
# stop_button.click(read_logs, None, logs, cancels=[inf2])
|
865 |
upload_button.upload(func_upload_file, [upload_button, chatbot], chatbot)
|
866 |
agentchoice.change(SetAgent, agentchoice, None)
|
|
|
796 |
soundfilename = Filename_Chatbot
|
797 |
return soundfilename
|
798 |
|
799 |
+
def HMI_Runing():
|
800 |
+
return [gr.update(visible=False), gr.update(visible=True)]
|
801 |
+
|
802 |
+
def HMI_Wait():
|
803 |
+
return [gr.update(visible=True), gr.update(visible=False)]
|
804 |
+
|
805 |
+
|
806 |
with gr.Blocks() as demo:
|
807 |
# gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
|
808 |
# main = gr.ChatInterface(
|
|
|
823 |
placeholder = "Input Your Question",
|
824 |
show_label = False,
|
825 |
)
|
826 |
+
submit_button = gr.Button("STOP", variant="primary", visible=True)
|
827 |
+
stop_button = gr.Button("STOP", variant='stop', visible=False)
|
828 |
|
829 |
with gr.Row():
|
830 |
|
|
|
865 |
retry_button.click(retry, chatbot, chatbot)
|
866 |
inf1 = inputtext.submit(chathmi3, [inputtext, chatbot], [inputtext, chatbot]).\
|
867 |
then(playsound, None, voice_output)
|
868 |
+
inf3 = submit_button.click(HMI_Runing, None, [submit_button, stop_button]).\
|
869 |
+
then(chathmi3, [inputtext, chatbot], [inputtext, chatbot]).\
|
870 |
+
then(playsound, None, voice_output).\
|
871 |
+
then(HMI_Wait, None, [submit_button, stop_button])
|
872 |
# inf2 = inputtext.submit(display_input, [inputtext, chatbot], chatbot).\
|
873 |
# then(Inference_Agent, chatbot, [inputtext, chatbot])
|
874 |
+
stop_button.click(read_logs, None, logs, cancels=[inf1,inf3]).\
|
875 |
+
then(HMI_Wait, None, [submit_button, stop_button])
|
876 |
# stop_button.click(read_logs, None, logs, cancels=[inf2])
|
877 |
upload_button.upload(func_upload_file, [upload_button, chatbot], chatbot)
|
878 |
agentchoice.change(SetAgent, agentchoice, None)
|