Update app.py
Browse files
app.py
CHANGED
@@ -62,7 +62,8 @@ class Dost:
|
|
62 |
print(self.result)
|
63 |
self.result.append(fp.name)
|
64 |
|
65 |
-
def start(self, audio):
|
|
|
66 |
self.result = []
|
67 |
self.recognize(audio)
|
68 |
print(self.result)
|
@@ -70,12 +71,13 @@ class Dost:
|
|
70 |
|
71 |
dost = Dost()
|
72 |
with gr.Blocks() as demo:
|
|
|
73 |
with gr.Row():
|
74 |
with gr.Column():
|
75 |
input_audio = gr.Audio(source="microphone", type="filepath")
|
76 |
btn = gr.Button("Submit")
|
77 |
conversation = gr.Chatbot(value=dost.convHistory)
|
78 |
output_audio = gr.Audio(label="AI voice response")
|
79 |
-
btn.click(dost.start, inputs=[input_audio], outputs=[conversation, output_audio])
|
80 |
|
81 |
demo.launch(debug=True)
|
|
|
62 |
print(self.result)
|
63 |
self.result.append(fp.name)
|
64 |
|
65 |
+
def start(self, audio, state):
|
66 |
+
self.convHistory = state
|
67 |
self.result = []
|
68 |
self.recognize(audio)
|
69 |
print(self.result)
|
|
|
71 |
|
72 |
dost = Dost()
|
73 |
with gr.Blocks() as demo:
|
74 |
+
state = gr.State([])
|
75 |
with gr.Row():
|
76 |
with gr.Column():
|
77 |
input_audio = gr.Audio(source="microphone", type="filepath")
|
78 |
btn = gr.Button("Submit")
|
79 |
conversation = gr.Chatbot(value=dost.convHistory)
|
80 |
output_audio = gr.Audio(label="AI voice response")
|
81 |
+
btn.click(dost.start, inputs=[input_audio, state], outputs=[conversation, output_audio])
|
82 |
|
83 |
demo.launch(debug=True)
|