Spaces:
Build error
Build error
Update app.py (#6)
Browse files- Update app.py (155675e86db9e228a7d1c54894527b882d46c74f)
app.py
CHANGED
|
@@ -488,6 +488,13 @@ def transcribe_audio_app(audio_path):
|
|
| 488 |
|
| 489 |
return transcription
|
| 490 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 491 |
|
| 492 |
demo = gr.Blocks(css=".markdown-body { font-size: 18px; }")
|
| 493 |
|
|
@@ -576,19 +583,28 @@ with demo:
|
|
| 576 |
outputs=[gen_key_btn],
|
| 577 |
) """
|
| 578 |
|
| 579 |
-
msg = gr.Textbox()
|
| 580 |
-
|
| 581 |
-
|
|
|
|
|
|
|
| 582 |
|
| 583 |
with gr.Row():
|
| 584 |
-
audio_btn = gr.Button('
|
| 585 |
-
|
|
|
|
| 586 |
|
| 587 |
-
audio_btn.click(fn=
|
| 588 |
.then(fn=check_btn, inputs=audio_btn) \
|
| 589 |
-
.success(fn=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 590 |
|
| 591 |
-
|
| 592 |
|
| 593 |
########################## Transcription ##########################
|
| 594 |
with gr.Row():
|
|
|
|
| 488 |
|
| 489 |
return transcription
|
| 490 |
|
| 491 |
+
def enregistrer_audio(audio):
|
| 492 |
+
if audio is not None:
|
| 493 |
+
return audio
|
| 494 |
+
return None
|
| 495 |
+
|
| 496 |
+
|
| 497 |
+
|
| 498 |
|
| 499 |
demo = gr.Blocks(css=".markdown-body { font-size: 18px; }")
|
| 500 |
|
|
|
|
| 583 |
outputs=[gen_key_btn],
|
| 584 |
) """
|
| 585 |
|
| 586 |
+
msg = gr.Textbox(label="Message")
|
| 587 |
+
audio_output = gr.Audio(label="Audio enregistré", visible=False)
|
| 588 |
+
transcription_output = gr.Textbox(label="Transcription", lines=5)
|
| 589 |
+
|
| 590 |
+
audio_box = gr.Audio(label="Enregistrer Audio", source="microphone", type="filepath", elem_id='audio')
|
| 591 |
|
| 592 |
with gr.Row():
|
| 593 |
+
audio_btn = gr.Button('Enregistrer')
|
| 594 |
+
transcribe_btn = gr.Button('Transcrire')
|
| 595 |
+
clear = gr.Button("Effacer")
|
| 596 |
|
| 597 |
+
audio_btn.click(fn=enregistrer_audio, inputs=[audio_box], outputs=[audio_output, msg]) \
|
| 598 |
.then(fn=check_btn, inputs=audio_btn) \
|
| 599 |
+
.success(fn=lambda: "Audio enregistré avec succès!", outputs=msg)
|
| 600 |
+
|
| 601 |
+
transcribe_btn.click(
|
| 602 |
+
fn=transcribe_audio_app,
|
| 603 |
+
inputs=[audio_output],
|
| 604 |
+
outputs=[transcription_output]
|
| 605 |
+
)
|
| 606 |
|
| 607 |
+
clear.click(lambda: (None, None, None), None, [audio_output, msg, transcription_output], queue=False)
|
| 608 |
|
| 609 |
########################## Transcription ##########################
|
| 610 |
with gr.Row():
|