cstr commited on
Commit
ecc4d6e
1 Parent(s): d290706

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -701,17 +701,19 @@ with gr.Blocks() as iface:
701
  gr.Markdown("Transcribe audio using multiple pipelines and (Faster) Whisper models.")
702
 
703
  with gr.Row():
704
- audio_upload = gr.Audio(label="Upload or Record Audio", source="upload")
 
705
  audio_url = gr.Textbox(label="Or Enter URL of audio file or YouTube link")
706
-
707
- with gr.Row():
708
- proxy_url = gr.Textbox(label="Proxy URL", placeholder="Enter proxy URL if needed", value="", lines=1)
709
- proxy_username = gr.Textbox(label="Proxy Username", placeholder="Proxy username (optional)", value="", lines=1)
710
- proxy_password = gr.Textbox(label="Proxy Password", placeholder="Proxy password (optional)", value="", lines=1, type="password")
711
 
712
  transcribe_button = gr.Button("Transcribe")
713
 
714
  with gr.Accordion("Advanced Options", open=False):
 
 
 
 
 
 
715
  with gr.Row():
716
  pipeline_type = gr.Dropdown(
717
  choices=["faster-batched", "faster-sequenced", "transformers"],
@@ -769,12 +771,15 @@ with gr.Blocks() as iface:
769
  pipeline_type.change(update_model_dropdown, inputs=[pipeline_type], outputs=[model_id])
770
 
771
  def transcribe_with_progress(*args):
772
- for result in transcribe_audio(*args):
 
 
 
773
  yield result
774
 
775
  transcribe_button.click(
776
  transcribe_with_progress,
777
- inputs=[audio_upload, audio_url, proxy_url, proxy_username, proxy_password, pipeline_type, model_id, dtype, batch_size, download_method, start_time, end_time, verbose, include_timecodes],
778
  outputs=[metrics_output, transcription_output, transcription_file]
779
  )
780
 
 
701
  gr.Markdown("Transcribe audio using multiple pipelines and (Faster) Whisper models.")
702
 
703
  with gr.Row():
704
+ audio_upload = gr.Audio(label="Upload Audio")
705
+ audio_record = gr.Audio(label="Record Audio", source="microphone")
706
  audio_url = gr.Textbox(label="Or Enter URL of audio file or YouTube link")
 
 
 
 
 
707
 
708
  transcribe_button = gr.Button("Transcribe")
709
 
710
  with gr.Accordion("Advanced Options", open=False):
711
+ with gr.Row():
712
+ proxy_url = gr.Textbox(label="Proxy URL", placeholder="Enter proxy URL if needed", value="", lines=1)
713
+ proxy_username = gr.Textbox(label="Proxy Username", placeholder="Proxy username (optional)", value="", lines=1)
714
+ proxy_password = gr.Textbox(label="Proxy Password", placeholder="Proxy password (optional)", value="", lines=1, type="password")
715
+
716
+
717
  with gr.Row():
718
  pipeline_type = gr.Dropdown(
719
  choices=["faster-batched", "faster-sequenced", "transformers"],
 
771
  pipeline_type.change(update_model_dropdown, inputs=[pipeline_type], outputs=[model_id])
772
 
773
  def transcribe_with_progress(*args):
774
+ # Combine audio_upload and audio_record into a single input
775
+ audio_input = args[0] if args[0] is not None else args[1]
776
+ modified_args = (audio_input,) + args[2:]
777
+ for result in transcribe_audio(*modified_args):
778
  yield result
779
 
780
  transcribe_button.click(
781
  transcribe_with_progress,
782
+ inputs=[audio_upload, audio_record, audio_url, proxy_url, proxy_username, proxy_password, pipeline_type, model_id, dtype, batch_size, download_method, start_time, end_time, verbose, include_timecodes],
783
  outputs=[metrics_output, transcription_output, transcription_file]
784
  )
785