TaiYouWeb commited on
Commit
0a0e499
1 Parent(s): 3197ebe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -100,7 +100,7 @@ def transcribe(inputs, model, language, batch_size, chunk_length_s, stride_lengt
100
 
101
  except Exception as e:
102
  error_message = str(e)
103
- raise gr.Error(error_message, duration=10)
104
 
105
  def _download_yt_audio(yt_url, filename):
106
  info_loader = youtube_dl.YoutubeDL()
@@ -127,7 +127,7 @@ def _download_yt_audio(yt_url, filename):
127
  if file_length_s > YT_LENGTH_LIMIT_S:
128
  yt_length_limit_hms = time.strftime("%HH:%MM:%SS", time.gmtime(YT_LENGTH_LIMIT_S))
129
  file_length_hms = time.strftime("%HH:%MM:%SS", time.gmtime(file_length_s))
130
- raise gr.Error(f"Maximum YouTube length is {yt_length_limit_hms}, got {file_length_hms} YouTube video.", duration=10)
131
 
132
  try:
133
  ydl_opts = {
@@ -138,7 +138,7 @@ def _download_yt_audio(yt_url, filename):
138
  ydl.download([yt_url])
139
  except youtube_dl.utils.ExtractorError as err:
140
  available_formats = info_loader.extract_info(yt_url, download=False)['formats']
141
- raise gr.Error(f"Requested format not available. Available formats: {available_formats}", duration=10)
142
 
143
  def _return_yt_video_id(yt_url):
144
  if "https://www.youtube.com/watch?v=" in yt_url:
@@ -264,7 +264,7 @@ def yt_transcribe(yt_url, model, language, batch_size, chunk_length_s, stride_le
264
 
265
  except Exception as e:
266
  error_message = str(e)
267
- gr.Warning(error_message, duration=10)
268
  return gr.Textbox(visible=False),gr.Textbox(visible=False), gr_title, gr_html, gr_thumbnail, gr_description, gr_keywords
269
 
270
  demo = gr.Blocks()
 
100
 
101
  except Exception as e:
102
  error_message = str(e)
103
+ raise gr.Error(error_message, duration=20)
104
 
105
  def _download_yt_audio(yt_url, filename):
106
  info_loader = youtube_dl.YoutubeDL()
 
127
  if file_length_s > YT_LENGTH_LIMIT_S:
128
  yt_length_limit_hms = time.strftime("%HH:%MM:%SS", time.gmtime(YT_LENGTH_LIMIT_S))
129
  file_length_hms = time.strftime("%HH:%MM:%SS", time.gmtime(file_length_s))
130
+ raise gr.Error(f"Maximum YouTube length is {yt_length_limit_hms}, got {file_length_hms} YouTube video.", duration=20)
131
 
132
  try:
133
  ydl_opts = {
 
138
  ydl.download([yt_url])
139
  except youtube_dl.utils.ExtractorError as err:
140
  available_formats = info_loader.extract_info(yt_url, download=False)['formats']
141
+ raise gr.Error(f"Requested format not available. Available formats: {available_formats}", duration=20)
142
 
143
  def _return_yt_video_id(yt_url):
144
  if "https://www.youtube.com/watch?v=" in yt_url:
 
264
 
265
  except Exception as e:
266
  error_message = str(e)
267
+ gr.Warning(error_message, duration=20)
268
  return gr.Textbox(visible=False),gr.Textbox(visible=False), gr_title, gr_html, gr_thumbnail, gr_description, gr_keywords
269
 
270
  demo = gr.Blocks()