Spaces:
Sleeping
Sleeping
Update app.py
#6
by
OthmaneLKH
- opened
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 |
|
@@ -573,19 +580,28 @@ with demo:
|
|
573 |
outputs=[gen_key_btn],
|
574 |
) """
|
575 |
|
576 |
-
msg = gr.Textbox()
|
577 |
-
|
578 |
-
|
|
|
|
|
579 |
|
580 |
with gr.Row():
|
581 |
-
audio_btn = gr.Button('
|
582 |
-
|
|
|
583 |
|
584 |
-
audio_btn.click(fn=
|
585 |
.then(fn=check_btn, inputs=audio_btn) \
|
586 |
-
.success(fn=
|
|
|
|
|
|
|
|
|
|
|
|
|
587 |
|
588 |
-
|
589 |
|
590 |
########################## Transcription ##########################
|
591 |
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 |
|
|
|
580 |
outputs=[gen_key_btn],
|
581 |
) """
|
582 |
|
583 |
+
msg = gr.Textbox(label="Message")
|
584 |
+
audio_output = gr.Audio(label="Audio enregistré", visible=False)
|
585 |
+
transcription_output = gr.Textbox(label="Transcription", lines=5)
|
586 |
+
|
587 |
+
audio_box = gr.Audio(label="Enregistrer Audio", source="microphone", type="filepath", elem_id='audio')
|
588 |
|
589 |
with gr.Row():
|
590 |
+
audio_btn = gr.Button('Enregistrer')
|
591 |
+
transcribe_btn = gr.Button('Transcrire')
|
592 |
+
clear = gr.Button("Effacer")
|
593 |
|
594 |
+
audio_btn.click(fn=enregistrer_audio, inputs=[audio_box], outputs=[audio_output, msg]) \
|
595 |
.then(fn=check_btn, inputs=audio_btn) \
|
596 |
+
.success(fn=lambda: "Audio enregistré avec succès!", outputs=msg)
|
597 |
+
|
598 |
+
transcribe_btn.click(
|
599 |
+
fn=transcribe_audio_app,
|
600 |
+
inputs=[audio_output],
|
601 |
+
outputs=[transcription_output]
|
602 |
+
)
|
603 |
|
604 |
+
clear.click(lambda: (None, None, None), None, [audio_output, msg, transcription_output], queue=False)
|
605 |
|
606 |
########################## Transcription ##########################
|
607 |
with gr.Row():
|