mzameshina commited on
Commit
b8a4ad4
1 Parent(s): 8834093

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -25
app.py CHANGED
@@ -488,13 +488,6 @@ def transcribe_audio_app(audio_path):
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,28 +576,19 @@ with demo:
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():
@@ -638,7 +622,14 @@ with demo:
638
 
639
  ########################## Main document Part ##########################
640
 
641
- with gr.Row(visible=False):
 
 
 
 
 
 
 
642
  with gr.Column(scale=5):
643
  original_sentences_box = gr.CheckboxGroup(
644
  ORIGINAL_DOCUMENT,
 
488
 
489
  return transcription
490
 
 
 
 
 
 
 
 
491
 
492
  demo = gr.Blocks(css=".markdown-body { font-size: 18px; }")
493
 
 
576
  outputs=[gen_key_btn],
577
  ) """
578
 
579
+ msg = gr.Textbox()
580
+
581
+ audio_box = gr.Audio(label="Audio", type="filepath", elem_id='audio')
 
 
582
 
583
  with gr.Row():
584
+ audio_btn = gr.Button('Speak')
585
+ clear = gr.Button("Clear")
 
586
 
587
+ audio_btn.click(fn=action, inputs=audio_btn, outputs=audio_btn) \
588
  .then(fn=check_btn, inputs=audio_btn) \
589
+ .success(fn=transcribe_audio_app, outputs=msg)
 
 
 
 
 
 
590
 
591
+ clear.click(lambda: None, None, msg, queue=False)
592
 
593
  ########################## Transcription ##########################
594
  with gr.Row():
 
622
 
623
  ########################## Main document Part ##########################
624
 
625
+ gr.Markdown("<hr />")
626
+ gr.Markdown("## Step 2.1: Select the document you want to encrypt\n\n"
627
+ """To make it simple, we pre-compiled the following document, but you are free to choose
628
+ on which part you want to run this example.
629
+ """
630
+ )
631
+
632
+ with gr.Row():
633
  with gr.Column(scale=5):
634
  original_sentences_box = gr.CheckboxGroup(
635
  ORIGINAL_DOCUMENT,