Spaces:
Runtime error
Runtime error
Commit
·
1fa0886
1
Parent(s):
bad025d
Update app.py
Browse files
app.py
CHANGED
|
@@ -88,11 +88,20 @@ with gr.Blocks(css=css) as demo:
|
|
| 88 |
|
| 89 |
with gr.Row(elem_id="audio-container").style(mobile_collapse=False, equal_height=True):
|
| 90 |
with gr.Column(scale=0.8):
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
with gr.Column(scale=0.2, min_width=0):
|
| 93 |
speech = gr.Button("Submit speech")
|
| 94 |
|
| 95 |
-
|
|
|
|
| 96 |
txt.submit(user, [txt, chatbot], [txt, chatbot], queue=False).then(
|
| 97 |
bot, chatbot, chatbot
|
| 98 |
)
|
|
|
|
| 88 |
|
| 89 |
with gr.Row(elem_id="audio-container").style(mobile_collapse=False, equal_height=True):
|
| 90 |
with gr.Column(scale=0.8):
|
| 91 |
+
recorder = gr.Audio(source="microphone", type="filepath", show_label=False, visible=False).style(container=False)
|
| 92 |
+
|
| 93 |
+
action_btn = gradio.Button('Start')
|
| 94 |
+
def next_line(action, _):
|
| 95 |
+
if action == 'Start':
|
| 96 |
+
return {action_btn: 'Next', recorder: gradio.update(visible=True)}
|
| 97 |
+
else:
|
| 98 |
+
return {action_btn: 'Done', recorder: gradio.update(visible=False)}
|
| 99 |
+
|
| 100 |
with gr.Column(scale=0.2, min_width=0):
|
| 101 |
speech = gr.Button("Submit speech")
|
| 102 |
|
| 103 |
+
action_btn.click(next_line, inputs=[action_btn, recorder], outputs=[action_btn, recorder])
|
| 104 |
+
speech.click(transcribe, inputs=recorder, outputs=txt)
|
| 105 |
txt.submit(user, [txt, chatbot], [txt, chatbot], queue=False).then(
|
| 106 |
bot, chatbot, chatbot
|
| 107 |
)
|