Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -53,16 +53,22 @@ def chatbot_response(text_input, voice_input):
|
|
53 |
# Return response text and audio for display in interface
|
54 |
return response_text, response_audio
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
64 |
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
67 |
|
68 |
|
|
|
53 |
# Return response text and audio for display in interface
|
54 |
return response_text, response_audio
|
55 |
|
56 |
+
def run():
|
57 |
+
global chat_history
|
58 |
+
chat_history = ""
|
59 |
+
interface = gr.Interface(
|
60 |
+
fn=chat,
|
61 |
+
inputs=["text", gr.inputs.Dropdown(["en-US-Wavenet-A", "en-US-Wavenet-B", "en-US-Wavenet-C", "en-US-Wavenet-D"])],
|
62 |
+
outputs=["text", "audio"],
|
63 |
+
layout="vertical",
|
64 |
+
title="OpenAI Chatbot with Speech Output",
|
65 |
+
description="Chat with the OpenAI GPT-3 chatbot and get speech output of the bot's response."
|
66 |
+
)
|
67 |
|
68 |
+
interface.launch()
|
69 |
+
while True:
|
70 |
+
time.sleep(0.1)
|
71 |
+
with open("chat_history.txt", "w") as f:
|
72 |
+
f.write(chat_history)
|
73 |
|
74 |
|