Spaces:
Paused
Paused
Commit ·
6dba563
1
Parent(s): 26ea281
fix: add stop_recording JS fallback to auto-submit Q&A
Browse filesCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
app.py
CHANGED
|
@@ -1097,6 +1097,19 @@ with gr.Blocks(title="MomsVoice", css=css_code) as demo:
|
|
| 1097 |
outputs=[answer_display, answer_audio]
|
| 1098 |
)
|
| 1099 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1100 |
# 10. Resume button — dismiss Q&A panel, show Play to continue
|
| 1101 |
def enter_resume_state():
|
| 1102 |
status_html = """
|
|
|
|
| 1097 |
outputs=[answer_display, answer_audio]
|
| 1098 |
)
|
| 1099 |
|
| 1100 |
+
# Also trigger on stop_recording with JS fallback to click submit button
|
| 1101 |
+
question_audio.stop_recording(
|
| 1102 |
+
fn=None,
|
| 1103 |
+
inputs=None,
|
| 1104 |
+
outputs=None,
|
| 1105 |
+
js="""() => {
|
| 1106 |
+
setTimeout(() => {
|
| 1107 |
+
const btn = document.querySelector('#qa_submit_btn button, #qa_submit_btn');
|
| 1108 |
+
if (btn) btn.click();
|
| 1109 |
+
}, 600);
|
| 1110 |
+
}"""
|
| 1111 |
+
)
|
| 1112 |
+
|
| 1113 |
# 10. Resume button — dismiss Q&A panel, show Play to continue
|
| 1114 |
def enter_resume_state():
|
| 1115 |
status_html = """
|