Aniquel commited on
Commit
f1fd01a
1 Parent(s): 8bf31b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
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
- # Define chatbot interface
57
- chatbot_interface = gr.Interface(
58
- fn=chatbot_response,
59
- inputs=["text", gr.inputs.Microphone(type="live", duration=10)],
60
- outputs=["text", "audio"],
61
- title="Chatbot",
62
- description="Talk to the chatbot using text and speech inputs."
63
- )
 
 
 
64
 
65
- # Launch chatbot interface
66
- chatbot_interface.launch()
 
 
 
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