barto17 commited on
Commit
4442b41
1 Parent(s): 03e7aa0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -62,7 +62,7 @@ LANGUANGE_MAP = {
62
  import whisper
63
 
64
  # define function for transcription
65
- def transcribe(Microphone, File_Upload):
66
  warn_output = ""
67
  if (Microphone is not None) and (File_Upload is not None):
68
  warn_output = "WARNING: You've uploaded an audio file and used the microphone. " \
@@ -74,6 +74,10 @@ def transcribe(Microphone, File_Upload):
74
 
75
  elif Microphone is not None:
76
  file = Microphone
 
 
 
 
77
  else:
78
  file = File_Upload
79
 
@@ -172,6 +176,7 @@ gr.Interface(
172
  inputs=[
173
  gr.inputs.Audio(source="microphone", type='filepath', optional=True),
174
  gr.inputs.Audio(source="upload", type='filepath', optional=True),
 
175
  ],
176
 
177
  outputs=[
 
62
  import whisper
63
 
64
  # define function for transcription
65
+ def transcribe(Microphone, File_Upload, URL):
66
  warn_output = ""
67
  if (Microphone is not None) and (File_Upload is not None):
68
  warn_output = "WARNING: You've uploaded an audio file and used the microphone. " \
 
74
 
75
  elif Microphone is not None:
76
  file = Microphone
77
+
78
+ else if URL:
79
+ link = YouTube(url)
80
+ source = link.streams.filter(only_audio=True)[0].download(filename="audio.mp4")
81
  else:
82
  file = File_Upload
83
 
 
176
  inputs=[
177
  gr.inputs.Audio(source="microphone", type='filepath', optional=True),
178
  gr.inputs.Audio(source="upload", type='filepath', optional=True),
179
+ gr.Textbox(label="Paste YouTube link here"),
180
  ],
181
 
182
  outputs=[