Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,6 +56,7 @@ def textGPT2(chat_history, text):
|
|
| 56 |
response = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages)
|
| 57 |
|
| 58 |
system_message = response["choices"][0]["message"]
|
|
|
|
| 59 |
|
| 60 |
return chat_history + [[text, system_message]]
|
| 61 |
|
|
@@ -71,7 +72,7 @@ with gr.Blocks() as test:
|
|
| 71 |
msg = gr.Textbox()
|
| 72 |
clear = gr.Button("Clear")
|
| 73 |
msg.submit(textGPT2, [chatbot, msg], chatbot)
|
| 74 |
-
clear.click(
|
| 75 |
|
| 76 |
|
| 77 |
text = gr.Interface(fn=textGPT, inputs="text", outputs="text")
|
|
|
|
| 56 |
response = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages)
|
| 57 |
|
| 58 |
system_message = response["choices"][0]["message"]
|
| 59 |
+
messages.append(system_message)
|
| 60 |
|
| 61 |
return chat_history + [[text, system_message]]
|
| 62 |
|
|
|
|
| 72 |
msg = gr.Textbox()
|
| 73 |
clear = gr.Button("Clear")
|
| 74 |
msg.submit(textGPT2, [chatbot, msg], chatbot)
|
| 75 |
+
clear.click(fn=clear, None, chatbot, queue=False)
|
| 76 |
|
| 77 |
|
| 78 |
text = gr.Interface(fn=textGPT, inputs="text", outputs="text")
|