Spaces:
Runtime error
Runtime error
thekivashyn
commited on
Commit
•
4c33aab
1
Parent(s):
6ee747d
update
Browse files
app.py
CHANGED
@@ -259,9 +259,9 @@ def load_chain(tools_list, llm):
|
|
259 |
return chain, express_chain, memory
|
260 |
|
261 |
|
262 |
-
def set_openai_api_key(
|
263 |
-
|
264 |
-
os.environ["OPENAI_API_KEY"] =
|
265 |
print("\n\n ++++++++++++++ Setting OpenAI API key ++++++++++++++ \n\n")
|
266 |
print(str(datetime.datetime.now()) + ": Before OpenAI, OPENAI_API_KEY length: " + str(
|
267 |
len(os.environ["OPENAI_API_KEY"])))
|
@@ -276,7 +276,7 @@ def set_openai_api_key(api_key):
|
|
276 |
|
277 |
print(str(datetime.datetime.now()) + ": After load_chain, OPENAI_API_KEY length: " + str(
|
278 |
len(os.environ["OPENAI_API_KEY"])))
|
279 |
-
|
280 |
return chain, express_chain, llm, embeddings, qa_chain, memory
|
281 |
|
282 |
|
@@ -830,9 +830,7 @@ with gr.Blocks(css=".gradio-container {background-color: lightgray}") as block:
|
|
830 |
outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
|
831 |
# outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
|
832 |
|
833 |
-
openai_api_key_textbox.change(set_openai_api_key,
|
834 |
-
|
835 |
-
outputs=[chain_state, express_chain_state, llm_state, embeddings_state,
|
836 |
-
qa_chain_state, memory_state])
|
837 |
# openai_api_key_textbox = "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"
|
838 |
block.launch(debug=True)
|
|
|
259 |
return chain, express_chain, memory
|
260 |
|
261 |
|
262 |
+
def set_openai_api_key():
|
263 |
+
|
264 |
+
os.environ["OPENAI_API_KEY"] = "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"
|
265 |
print("\n\n ++++++++++++++ Setting OpenAI API key ++++++++++++++ \n\n")
|
266 |
print(str(datetime.datetime.now()) + ": Before OpenAI, OPENAI_API_KEY length: " + str(
|
267 |
len(os.environ["OPENAI_API_KEY"])))
|
|
|
276 |
|
277 |
print(str(datetime.datetime.now()) + ": After load_chain, OPENAI_API_KEY length: " + str(
|
278 |
len(os.environ["OPENAI_API_KEY"])))
|
279 |
+
|
280 |
return chain, express_chain, llm, embeddings, qa_chain, memory
|
281 |
|
282 |
|
|
|
830 |
outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
|
831 |
# outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
|
832 |
|
833 |
+
openai_api_key_textbox.change(set_openai_api_key, outputs=[chain_state, express_chain_state, llm_state, embeddings_state, qa_chain_state, memory_state])
|
834 |
+
|
|
|
|
|
835 |
# openai_api_key_textbox = "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"
|
836 |
block.launch(debug=True)
|