Edward Nagy commited on
Commit
aa65169
1 Parent(s): c286cd9

Refactor transcribe function to prioritize video

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -37,16 +37,16 @@ def transcribe_video(video_url):
37
 
38
 
39
  def transcribe(video_url="", audio=None):
40
- if audio:
41
- return transcribe_audio(audio)
42
- elif video_url:
43
  return transcribe_video(video_url)
 
 
44
 
45
 
46
  iface = gr.Interface(
47
  fn=transcribe,
48
  inputs=[
49
- gr.Textbox(label="Enter video URL"),
50
  gr.Audio(sources=["microphone"], type="filepath"),
51
  ],
52
  outputs="text",
 
37
 
38
 
39
  def transcribe(video_url="", audio=None):
40
+ if video_url.strip() != "":
 
 
41
  return transcribe_video(video_url)
42
+ else:
43
+ return transcribe_audio(audio)
44
 
45
 
46
  iface = gr.Interface(
47
  fn=transcribe,
48
  inputs=[
49
+ gr.Textbox(label="Enter video URL", placeholder="Or leave empty to use microphone"),
50
  gr.Audio(sources=["microphone"], type="filepath"),
51
  ],
52
  outputs="text",