Spaces:
Runtime error
Runtime error
Commit
·
05fc98b
1
Parent(s):
9490ac1
Feat: Disable buttons while audio recordings process.
Browse files
app.py
CHANGED
|
@@ -170,7 +170,8 @@ with gr.Blocks(theme=theme) as demo:
|
|
| 170 |
audio_input = gr.Audio(
|
| 171 |
sources=["microphone", "upload"],
|
| 172 |
type="filepath",
|
| 173 |
-
label="Record/Upload Audio (MP3, WAV, M4A, etc.)"
|
|
|
|
| 174 |
)
|
| 175 |
transcribe_btn = gr.Button("Transcribe Audio", variant="primary", size="lg")
|
| 176 |
|
|
@@ -206,18 +207,25 @@ with gr.Blocks(theme=theme) as demo:
|
|
| 206 |
|
| 207 |
gr.Markdown("""
|
| 208 |
### Example Questions to Try:
|
| 209 |
-
-
|
| 210 |
- What were the key points discussed?
|
| 211 |
-
-
|
| 212 |
-
- What
|
| 213 |
-
- Can you explain [concept] in simpler terms?
|
| 214 |
""")
|
| 215 |
|
| 216 |
# Event handlers
|
| 217 |
transcribe_btn.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
fn=transcribe_audio,
|
| 219 |
inputs=[audio_input],
|
| 220 |
outputs=[transcript_output, transcript_state, chatbot]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
)
|
| 222 |
|
| 223 |
ask_btn.click(
|
|
|
|
| 170 |
audio_input = gr.Audio(
|
| 171 |
sources=["microphone", "upload"],
|
| 172 |
type="filepath",
|
| 173 |
+
label="Record/Upload Audio (MP3, WAV, M4A, etc.)",
|
| 174 |
+
show_download_button=False
|
| 175 |
)
|
| 176 |
transcribe_btn = gr.Button("Transcribe Audio", variant="primary", size="lg")
|
| 177 |
|
|
|
|
| 207 |
|
| 208 |
gr.Markdown("""
|
| 209 |
### Example Questions to Try:
|
| 210 |
+
- Can you please summarize this?
|
| 211 |
- What were the key points discussed?
|
| 212 |
+
- What was the main topic?
|
| 213 |
+
- What is the TLDR version so I can just leave this conference call early?
|
|
|
|
| 214 |
""")
|
| 215 |
|
| 216 |
# Event handlers
|
| 217 |
transcribe_btn.click(
|
| 218 |
+
fn=disable_buttons,
|
| 219 |
+
inputs=None,
|
| 220 |
+
outputs=[transcribe_btn, ask_btn]
|
| 221 |
+
).then(
|
| 222 |
fn=transcribe_audio,
|
| 223 |
inputs=[audio_input],
|
| 224 |
outputs=[transcript_output, transcript_state, chatbot]
|
| 225 |
+
).then(
|
| 226 |
+
fn=enable_buttons,
|
| 227 |
+
inputs=None,
|
| 228 |
+
outputs=[transcribe_btn, ask_btn]
|
| 229 |
)
|
| 230 |
|
| 231 |
ask_btn.click(
|