Spaces:
Runtime error
Runtime error
Commit
·
c7d7bda
1
Parent(s):
fe8f569
update performance
Browse files
app.py
CHANGED
|
@@ -1837,35 +1837,35 @@ with gr.Blocks() as demo:
|
|
| 1837 |
# then(HMI_Wait, None, [submit_button, stop_button])
|
| 1838 |
# inf4 = inputtext.submit(chathmi4, [inputtext, chatbot], [inputtext, chatbot, submit_button, stop_button])
|
| 1839 |
''' open ai | new'''
|
| 1840 |
-
inf4 = inputtext.submit(chathmi4, [inputtext, chatbot], [inputtext, chatbot, submit_button, stop_button]).\
|
| 1841 |
-
success(playsound1, None, voice_output)#.\
|
| 1842 |
# success(ClearAudio, None, voice_output)
|
| 1843 |
|
| 1844 |
''' Test '''
|
| 1845 |
# inf4 = inputtext.submit(chatremote, [inputtext, chatbot], [inputtext, chatbot, submit_button, stop_button]).\
|
| 1846 |
# success(playsound1, None, voice_output)
|
| 1847 |
|
| 1848 |
-
inf3 = submit_button.click(chathmi3, [inputtext, chatbot], [inputtext, chatbot]).\
|
| 1849 |
-
success(HMI_Runing, None, [submit_button, stop_button]).\
|
| 1850 |
-
success(playsound1, None, voice_output).\
|
| 1851 |
-
success(HMI_Wait, None, [submit_button, stop_button])#.\
|
| 1852 |
# success(ClearAudio, None, voice_output)
|
| 1853 |
|
| 1854 |
# inf2 = inputtext.submit(display_input, [inputtext, chatbot], chatbot).\
|
| 1855 |
# then(Inference_Agent, chatbot, [inputtext, chatbot])
|
| 1856 |
-
stop_button.click(read_logs, None, logs, cancels=[inf4,inf3]).\
|
| 1857 |
-
then(HMI_Wait, None, [submit_button, stop_button])
|
| 1858 |
# stop_button.click(read_logs, None, logs, cancels=[inf2])
|
| 1859 |
upload_button.upload(func_upload_file, [upload_button, chatbot], chatbot)
|
| 1860 |
sum1 = summary_file_button.upload(Summary_upload_file, [summary_file_button, chatbot], chatbot)
|
| 1861 |
agentchoice.change(SetAgent, agentchoice, None)
|
| 1862 |
frash_logs.click(read_logs, None, logs)
|
| 1863 |
-
voice_input.stop_recording(SingleTalk, [voice_input, chatbot], [voice_input, voice_output, chatbot]).\
|
| 1864 |
-
success(Text2Sound_HMI,None,None).\
|
| 1865 |
-
success(playsound1, None, voice_output) #.\
|
| 1866 |
# success(HMI_Wait, None, [submit_button, stop_button]).\
|
| 1867 |
# success(ClearAudio, None, voice_output)
|
| 1868 |
-
clear_button.click(clearall, None, [chatbot, submit_button, stop_button], voice_output, cancels=[inf4,inf3,sum1])
|
| 1869 |
# voice_output.end(ClearAudio, None, voice_output)
|
| 1870 |
# def clear_voice():
|
| 1871 |
# print("clear audio ...")
|
|
@@ -1874,7 +1874,7 @@ with gr.Blocks() as demo:
|
|
| 1874 |
# voice_output.play(clear_voice, None, None)
|
| 1875 |
|
| 1876 |
# demo.load(read_logs, None, logs, every=1)
|
| 1877 |
-
demo.load(UpdateChatbot, chatbot, chatbot)
|
| 1878 |
# load(UpdateChatbot, chatbot, chatbot, every=5)
|
| 1879 |
|
| 1880 |
|
|
@@ -1988,6 +1988,13 @@ def chatText(Text):
|
|
| 1988 |
deployment_id="Chattester")
|
| 1989 |
print("\n" + response["choices"][0]["message"]["content"] + "\n")
|
| 1990 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1991 |
if __name__ == '__main__':
|
| 1992 |
# chatText("what is AI?")
|
| 1993 |
# CreatDb()
|
|
@@ -1999,10 +2006,11 @@ if __name__ == '__main__':
|
|
| 1999 |
|
| 2000 |
# asyncio.run(TestCodeInterpret('Plot the bitcoin chart of 2023 YTD'))
|
| 2001 |
|
| 2002 |
-
|
| 2003 |
-
|
| 2004 |
-
|
| 2005 |
-
|
|
|
|
| 2006 |
pass
|
| 2007 |
|
| 2008 |
|
|
|
|
| 1837 |
# then(HMI_Wait, None, [submit_button, stop_button])
|
| 1838 |
# inf4 = inputtext.submit(chathmi4, [inputtext, chatbot], [inputtext, chatbot, submit_button, stop_button])
|
| 1839 |
''' open ai | new'''
|
| 1840 |
+
inf4 = inputtext.submit(chathmi4, [inputtext, chatbot], [inputtext, chatbot, submit_button, stop_button], queue=False).\
|
| 1841 |
+
success(playsound1, None, voice_output, queue=False)#.\
|
| 1842 |
# success(ClearAudio, None, voice_output)
|
| 1843 |
|
| 1844 |
''' Test '''
|
| 1845 |
# inf4 = inputtext.submit(chatremote, [inputtext, chatbot], [inputtext, chatbot, submit_button, stop_button]).\
|
| 1846 |
# success(playsound1, None, voice_output)
|
| 1847 |
|
| 1848 |
+
inf3 = submit_button.click(chathmi3, [inputtext, chatbot], [inputtext, chatbot], queue=False).\
|
| 1849 |
+
success(HMI_Runing, None, [submit_button, stop_button], queue=False).\
|
| 1850 |
+
success(playsound1, None, voice_output, queue=False).\
|
| 1851 |
+
success(HMI_Wait, None, [submit_button, stop_button], queue=False)#.\
|
| 1852 |
# success(ClearAudio, None, voice_output)
|
| 1853 |
|
| 1854 |
# inf2 = inputtext.submit(display_input, [inputtext, chatbot], chatbot).\
|
| 1855 |
# then(Inference_Agent, chatbot, [inputtext, chatbot])
|
| 1856 |
+
stop_button.click(read_logs, None, logs, cancels=[inf4,inf3], queue=False).\
|
| 1857 |
+
then(HMI_Wait, None, [submit_button, stop_button], queue=False)
|
| 1858 |
# stop_button.click(read_logs, None, logs, cancels=[inf2])
|
| 1859 |
upload_button.upload(func_upload_file, [upload_button, chatbot], chatbot)
|
| 1860 |
sum1 = summary_file_button.upload(Summary_upload_file, [summary_file_button, chatbot], chatbot)
|
| 1861 |
agentchoice.change(SetAgent, agentchoice, None)
|
| 1862 |
frash_logs.click(read_logs, None, logs)
|
| 1863 |
+
voice_input.stop_recording(SingleTalk, [voice_input, chatbot], [voice_input, voice_output, chatbot], queue=False).\
|
| 1864 |
+
success(Text2Sound_HMI,None,None, queue=False).\
|
| 1865 |
+
success(playsound1, None, voice_output, queue=False) #.\
|
| 1866 |
# success(HMI_Wait, None, [submit_button, stop_button]).\
|
| 1867 |
# success(ClearAudio, None, voice_output)
|
| 1868 |
+
clear_button.click(clearall, None, [chatbot, submit_button, stop_button], voice_output, cancels=[inf4,inf3,sum1], queue=False)
|
| 1869 |
# voice_output.end(ClearAudio, None, voice_output)
|
| 1870 |
# def clear_voice():
|
| 1871 |
# print("clear audio ...")
|
|
|
|
| 1874 |
# voice_output.play(clear_voice, None, None)
|
| 1875 |
|
| 1876 |
# demo.load(read_logs, None, logs, every=1)
|
| 1877 |
+
demo.load(UpdateChatbot, chatbot, chatbot, queue=False)
|
| 1878 |
# load(UpdateChatbot, chatbot, chatbot, every=5)
|
| 1879 |
|
| 1880 |
|
|
|
|
| 1988 |
deployment_id="Chattester")
|
| 1989 |
print("\n" + response["choices"][0]["message"]["content"] + "\n")
|
| 1990 |
|
| 1991 |
+
def GUI_launcher():
|
| 1992 |
+
if SysLock == "1":
|
| 1993 |
+
demo.queue(concurrency_count=3).launch(auth=(username, password), server_name="0.0.0.0", server_port=7860)
|
| 1994 |
+
else:
|
| 1995 |
+
demo.queue(concurrency_count=3).launch(server_name="0.0.0.0", server_port=7860)
|
| 1996 |
+
|
| 1997 |
+
|
| 1998 |
if __name__ == '__main__':
|
| 1999 |
# chatText("what is AI?")
|
| 2000 |
# CreatDb()
|
|
|
|
| 2006 |
|
| 2007 |
# asyncio.run(TestCodeInterpret('Plot the bitcoin chart of 2023 YTD'))
|
| 2008 |
|
| 2009 |
+
GUI_launcher()
|
| 2010 |
+
# if SysLock == "1":
|
| 2011 |
+
# demo.queue(concurrency_count=3).launch(auth=(username, password), server_name="0.0.0.0", server_port=7860)
|
| 2012 |
+
# else:
|
| 2013 |
+
# demo.queue(concurrency_count=3).launch(server_name="0.0.0.0", server_port=7860)
|
| 2014 |
pass
|
| 2015 |
|
| 2016 |
|