ggoknar
commited on
Commit
•
404ae8a
1
Parent(s):
c6df1a5
make interactive after speech, update gradio
Browse files
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 🌪️
|
|
4 |
colorFrom: blue
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
|
|
4 |
colorFrom: blue
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 3.48.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
app.py
CHANGED
@@ -438,6 +438,10 @@ def generate_speech(history):
|
|
438 |
continue
|
439 |
|
440 |
if not DIRECT_STREAM:
|
|
|
|
|
|
|
|
|
441 |
yield (gr.Audio.update(value=wav_chunks, autoplay=True), history)
|
442 |
# Streaming wait time calculation
|
443 |
# audio_length = frame_length / sample_width/ frame_rate
|
@@ -530,6 +534,8 @@ with gr.Blocks(title=title) as demo:
|
|
530 |
add_file, [chatbot, btn], [chatbot, txt], queue=False
|
531 |
).then(generate_speech, chatbot, [audio, chatbot])
|
532 |
|
|
|
|
|
533 |
gr.Markdown(
|
534 |
"""
|
535 |
This Space demonstrates how to speak to a chatbot, based solely on open-source models.
|
|
|
438 |
continue
|
439 |
|
440 |
if not DIRECT_STREAM:
|
441 |
+
yield (
|
442 |
+
gr.Audio.update(value=None, autoplay=True),
|
443 |
+
history,
|
444 |
+
) # hack to switch autoplay
|
445 |
yield (gr.Audio.update(value=wav_chunks, autoplay=True), history)
|
446 |
# Streaming wait time calculation
|
447 |
# audio_length = frame_length / sample_width/ frame_rate
|
|
|
534 |
add_file, [chatbot, btn], [chatbot, txt], queue=False
|
535 |
).then(generate_speech, chatbot, [audio, chatbot])
|
536 |
|
537 |
+
file_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)
|
538 |
+
|
539 |
gr.Markdown(
|
540 |
"""
|
541 |
This Space demonstrates how to speak to a chatbot, based solely on open-source models.
|