Dorjzodovsuren commited on
Commit
57e1623
Β·
verified Β·
1 Parent(s): 35b0ccd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -16
app.py CHANGED
@@ -70,19 +70,13 @@ print("----------> Loaded models <-----------")
70
 
71
  gpu_timeout = int(os.getenv("GPU_TIMEOUT", 60))
72
  @spaces.GPU(duration=gpu_timeout)
73
- def generator(youtube_link, microphone, file_upload, num_speakers, max_duration, history):
74
-
75
- if int(youtube_link != '') + int(microphone is not None) + int(file_upload is not None) != 1:
76
- raise Exception(f"Only one of the source should be given youtube_link={youtube_link}, microphone={microphone}, file_upload={file_upload}")
77
-
78
  history = history or ""
79
 
80
  if microphone:
81
  path = microphone
82
  elif file_upload:
83
  path = file_upload
84
- elif youtube_link:
85
- path = download_from_youtube(youtube_link)
86
 
87
  waveform, sampling_rate = librosa.load(path, sr=SAMPLE_RATE, mono=True, duration=max_duration)
88
 
@@ -138,7 +132,6 @@ def generator(youtube_link, microphone, file_upload, num_speakers, max_duration,
138
  demo = gr.Interface(
139
  generator,
140
  inputs=[
141
- gr.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
142
  gr.Audio(type="filepath"),
143
  gr.Audio(type="filepath"),
144
  gr.Number(value=1, label="Number of Speakers"),
@@ -146,15 +139,9 @@ demo = gr.Interface(
146
  'state',
147
  ],
148
  outputs=['text', 'state', 'file'],
149
- theme="huggingface",
150
- title="Transcribe Mongolian Whisper πŸ‡²πŸ‡³",
151
  description=(
152
- "Transcribe Youtube Video / Microphone / Uploaded File in Mongolian Whisper Model." + \
153
- " | You can upload SubRip file (`.srt`) [to your youtube video](https://support.google.com/youtube/answer/2734698?hl=en#zippy=%2Cbasic-file-formats)." + \
154
- " | Please REFRESH πŸ”„ the page after you transcribed!" + \
155
- " | 🐦 [@_tsogoo_](https://twitter.com/_tsogoo_)" + \
156
- " | πŸ€— [@bayartsogt](https://huggingface.co/bayartsogt)" + \
157
- ""
158
  ),
159
  allow_flagging="never",
160
  )
 
70
 
71
  gpu_timeout = int(os.getenv("GPU_TIMEOUT", 60))
72
  @spaces.GPU(duration=gpu_timeout)
73
+ def generator(microphone, file_upload, num_speakers, max_duration, history):
 
 
 
 
74
  history = history or ""
75
 
76
  if microphone:
77
  path = microphone
78
  elif file_upload:
79
  path = file_upload
 
 
80
 
81
  waveform, sampling_rate = librosa.load(path, sr=SAMPLE_RATE, mono=True, duration=max_duration)
82
 
 
132
  demo = gr.Interface(
133
  generator,
134
  inputs=[
 
135
  gr.Audio(type="filepath"),
136
  gr.Audio(type="filepath"),
137
  gr.Number(value=1, label="Number of Speakers"),
 
139
  'state',
140
  ],
141
  outputs=['text', 'state', 'file'],
142
+ title="Mongolian Whisper πŸ‡²πŸ‡³",
 
143
  description=(
144
+ "Transcribe Microphone / Uploaded File in Mongolian Whisper Model."
 
 
 
 
 
145
  ),
146
  allow_flagging="never",
147
  )