Spaces:
Build error
Build error
Commit ·
33d9f7c
1
Parent(s): 39cb5ce
Update app.py
Browse files
app.py
CHANGED
|
@@ -893,45 +893,33 @@ openai_api_key_textbox.change(set_openai_api_key,
|
|
| 893 |
""")
|
| 894 |
|
| 895 |
gr.HTML("""<center>
|
| 896 |
-
|
| 897 |
-
|
| 898 |
-
|
| 899 |
-
|
| 900 |
-
with gr.blocks():
|
| 901 |
-
message.submit(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
|
| 902 |
-
speak_text_state, talking_head_state, monologue_state,
|
| 903 |
-
express_chain_state, num_words_state, formality_state,
|
| 904 |
-
anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
|
| 905 |
-
surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
|
| 906 |
-
lang_level_state, translate_to_state, literary_style_state,
|
| 907 |
-
qa_chain_state, docsearch_state, use_embeddings_state],
|
| 908 |
-
outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
|
| 909 |
-
# outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
|
| 910 |
-
|
| 911 |
submit.click(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
|
| 912 |
-
|
| 913 |
-
|
| 914 |
-
|
| 915 |
-
|
| 916 |
-
|
| 917 |
-
|
| 918 |
-
|
| 919 |
-
|
| 920 |
-
|
| 921 |
-
openai_api_key_textbox
|
| 922 |
-
|
| 923 |
-
|
| 924 |
-
|
| 925 |
-
|
| 926 |
-
|
| 927 |
-
|
| 928 |
-
|
| 929 |
-
|
| 930 |
-
|
| 931 |
-
openai_api_key_textbox
|
| 932 |
-
|
| 933 |
-
|
| 934 |
-
qa_chain_state, memory_state])
|
| 935 |
|
| 936 |
block.load(None, inputs=None, outputs=openai_api_key_textbox, _js="()=> localStorage.getItem('open_api_key')")
|
| 937 |
block.launch(debug=True)
|
|
|
|
| 893 |
""")
|
| 894 |
|
| 895 |
gr.HTML("""<center>
|
| 896 |
+
<a href="https://huggingface.co/spaces/JavaFXpert/Chat-GPT-LangChain?duplicate=true">
|
| 897 |
+
<img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
| 898 |
+
Powered by <a href='https://github.com/hwchase17/langchain'>LangChain 🦜️🔗</a>
|
| 899 |
+
</center>""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 900 |
submit.click(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
|
| 901 |
+
speak_text_state, talking_head_state, monologue_state,
|
| 902 |
+
express_chain_state, num_words_state, formality_state,
|
| 903 |
+
anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
|
| 904 |
+
surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
|
| 905 |
+
lang_level_state, translate_to_state, literary_style_state,
|
| 906 |
+
qa_chain_state, docsearch_state, use_embeddings_state],
|
| 907 |
+
outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
|
| 908 |
+
|
| 909 |
+
openai_api_key_textbox.change(None,
|
| 910 |
+
inputs=[openai_api_key_textbox],
|
| 911 |
+
outputs=None, _js="(api_key) => localStorage.setItem('open_api_key', api_key)")
|
| 912 |
+
|
| 913 |
+
async def handle_set_openai_api_key(api_key):
|
| 914 |
+
await set_openai_api_key(api_key)
|
| 915 |
+
|
| 916 |
+
def set_openai_api_key_wrapper(api_key):
|
| 917 |
+
asyncio.run(handle_set_openai_api_key(api_key))
|
| 918 |
+
|
| 919 |
+
openai_api_key_textbox.change(set_openai_api_key_wrapper,
|
| 920 |
+
inputs=[openai_api_key_textbox],
|
| 921 |
+
outputs=[chain_state, express_chain_state, llm_state, embeddings_state,
|
| 922 |
+
qa_chain_state, memory_state])
|
|
|
|
| 923 |
|
| 924 |
block.load(None, inputs=None, outputs=openai_api_key_textbox, _js="()=> localStorage.getItem('open_api_key')")
|
| 925 |
block.launch(debug=True)
|