ziqiangao commited on
Commit
0da6cf8
·
verified ·
1 Parent(s): 18d307c

Add Length Limit

Browse files

Added Length Limit because someone decided to upload a 30min clip

Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -375,6 +375,11 @@ def gradio_interface(audio_file, lyrics, output_name, fps=30, vidwidth=1280, vid
375
  if not str(audio_file).endswith(".mp3"):
376
  raise gr.Error("Only MP3 Files are supported at this time")
377
 
 
 
 
 
 
378
  resolution = f"{vidwidth}x{vidheight}"
379
  res = tuple(map(int, resolution.split('x')))
380
  video_file, haslyrics = main(audio_file, output_name, fps=fps,
 
375
  if not str(audio_file).endswith(".mp3"):
376
  raise gr.Error("Only MP3 Files are supported at this time")
377
 
378
+ # Check MP3 duration limit (15 min = 900 sec)
379
+ audio = MP3(audio_file.name)
380
+ if audio.info.length > 900:
381
+ raise gr.Error("The uploaded MP3 file exceeds the 15-minute limit. Please upload a shorter file.")
382
+
383
  resolution = f"{vidwidth}x{vidheight}"
384
  res = tuple(map(int, resolution.split('x')))
385
  video_file, haslyrics = main(audio_file, output_name, fps=fps,