charbaaz356 commited on
Commit
2c9a10f
·
1 Parent(s): 984b76d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -33
app.py CHANGED
@@ -899,42 +899,40 @@ openai_api_key_textbox.change(set_openai_api_key,
899
  Powered by <a href='https://github.com/hwchase17/langchain'>LangChain 🦜️🔗</a>
900
  </center>""")
901
 
902
- message.submit(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
903
- speak_text_state, talking_head_state, monologue_state,
904
- express_chain_state, num_words_state, formality_state,
905
- anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
906
- surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
907
- lang_level_state, translate_to_state, literary_style_state,
908
- qa_chain_state, docsearch_state, use_embeddings_state],
909
- outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
910
- # outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
911
-
912
- submit.click(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
913
- speak_text_state, talking_head_state, monologue_state,
914
- express_chain_state, num_words_state, formality_state,
915
- anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
916
- surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
917
- lang_level_state, translate_to_state, literary_style_state,
918
- qa_chain_state, docsearch_state, use_embeddings_state],
919
- outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
920
- # outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
921
-
922
- openai_api_key_textbox.change(None,
923
- inputs=[openai_api_key_textbox],
924
- outputs=None, _js="(api_key) => localStorage.setItem('open_api_key', api_key)")
925
-
926
- async def handle_set_openai_api_key(api_key):
927
- await set_openai_api_key(api_key)
928
-
929
- def set_openai_api_key_wrapper(api_key):
930
  asyncio.run(handle_set_openai_api_key(api_key))
931
 
932
- openai_api_key_textbox.change(set_openai_api_key_wrapper,
933
  inputs=[openai_api_key_textbox],
934
  outputs=[chain_state, express_chain_state, llm_state, embeddings_state,
935
  qa_chain_state, memory_state])
936
-
937
- block.load(None, inputs=None, outputs=openai_api_key_textbox, _js="()=> localStorage.getItem('open_api_key')")
938
-
939
 
940
- block.launch(debug=True)
 
 
899
  Powered by <a href='https://github.com/hwchase17/langchain'>LangChain 🦜️🔗</a>
900
  </center>""")
901
 
902
+ message.submit(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
903
+ speak_text_state, talking_head_state, monologue_state,
904
+ express_chain_state, num_words_state, formality_state,
905
+ anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
906
+ surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
907
+ lang_level_state, translate_to_state, literary_style_state,
908
+ qa_chain_state, docsearch_state, use_embeddings_state],
909
+ outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
910
+ # outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
911
+
912
+ submit.click(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
913
+ speak_text_state, talking_head_state, monologue_state,
914
+ express_chain_state, num_words_state, formality_state,
915
+ anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
916
+ surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
917
+ lang_level_state, translate_to_state, literary_style_state,
918
+ qa_chain_state, docsearch_state, use_embeddings_state],
919
+ outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
920
+ # outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
921
+
922
+ openai_api_key_textbox.change(None,
923
+ inputs=[openai_api_key_textbox],
924
+ outputs=None, _js="(api_key) => localStorage.setItem('open_api_key', api_key)")
925
+
926
+ async def handle_set_openai_api_key(api_key):
927
+ await set_openai_api_key(api_key)
928
+
929
+ def set_openai_api_key_wrapper(api_key):
930
  asyncio.run(handle_set_openai_api_key(api_key))
931
 
932
+ openai_api_key_textbox.change(set_openai_api_key_wrapper,
933
  inputs=[openai_api_key_textbox],
934
  outputs=[chain_state, express_chain_state, llm_state, embeddings_state,
935
  qa_chain_state, memory_state])
 
 
 
936
 
937
+ block.load(None, inputs=None, outputs=openai_api_key_textbox, _js="()=> localStorage.getItem('open_api_key')")
938
+ block.launch(debug=True)