Spaces:
Runtime error
Runtime error
Update test_chat.py
Browse files- test_chat.py +2 -10
test_chat.py
CHANGED
@@ -10,11 +10,6 @@ from openai import OpenAI
|
|
10 |
OpenAI.api_key = os.getenv("OPENAI_API_KEY")
|
11 |
api_key = os.getenv("OPENAI_API_KEY")
|
12 |
client = OpenAI(api_key=api_key)
|
13 |
-
# from langchain.schema import AIMessage, HumanMessage
|
14 |
-
# from langchain_community.chat_models import ChatOpenAI
|
15 |
-
|
16 |
-
|
17 |
-
# import openai
|
18 |
|
19 |
|
20 |
os.environ["no_proxy"] = "localhost,127.0.0.1,::1"
|
@@ -67,7 +62,7 @@ def predict(message, history):
|
|
67 |
|
68 |
with gr.Blocks() as TESTCHAT:
|
69 |
chatbot = gr.Chatbot(
|
70 |
-
[
|
71 |
elem_id="chatbot",
|
72 |
bubble_full_width=False,
|
73 |
# avatar_images=(None, (os.path.join(os.path.dirname(__file__), "avatar.png"))),
|
@@ -82,11 +77,8 @@ with gr.Blocks() as TESTCHAT:
|
|
82 |
)
|
83 |
btn = gr.UploadButton("📁", file_types=["image", "video", "audio"])
|
84 |
|
85 |
-
# txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
|
86 |
-
# bot, chatbot, chatbot, api_name="bot_response"
|
87 |
-
# )
|
88 |
txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
|
89 |
-
|
90 |
)
|
91 |
|
92 |
txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
|
|
|
10 |
OpenAI.api_key = os.getenv("OPENAI_API_KEY")
|
11 |
api_key = os.getenv("OPENAI_API_KEY")
|
12 |
client = OpenAI(api_key=api_key)
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
|
15 |
os.environ["no_proxy"] = "localhost,127.0.0.1,::1"
|
|
|
62 |
|
63 |
with gr.Blocks() as TESTCHAT:
|
64 |
chatbot = gr.Chatbot(
|
65 |
+
[],
|
66 |
elem_id="chatbot",
|
67 |
bubble_full_width=False,
|
68 |
# avatar_images=(None, (os.path.join(os.path.dirname(__file__), "avatar.png"))),
|
|
|
77 |
)
|
78 |
btn = gr.UploadButton("📁", file_types=["image", "video", "audio"])
|
79 |
|
|
|
|
|
|
|
80 |
txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
|
81 |
+
bot, chatbot, chatbot, api_name="bot_response"
|
82 |
)
|
83 |
|
84 |
txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
|