xmrt commited on
Commit
f10c44c
·
1 Parent(s): 98fc48d

added return in check extension

Browse files
Files changed (1) hide show
  1. main_noweb.py +7 -1
main_noweb.py CHANGED
@@ -79,6 +79,13 @@ def get_frames(video, fps=50, height=512, width=512):
79
 
80
 
81
  def check_extension(video):
 
 
 
 
 
 
 
82
  split_tup = os.path.splitext(video)
83
 
84
  # extract the file name and extension
@@ -87,7 +94,6 @@ def check_extension(video):
87
 
88
  if file_extension != ".mp4":
89
  print("Converting to mp4")
90
- clip = moviepy.VideoFileClip(video)
91
 
92
  video = file_name+".mp4"
93
  clip.write_videofile(video)
 
79
 
80
 
81
  def check_extension(video):
82
+
83
+ clip = moviepy.VideoFileClip(video)
84
+ print(clip.duration)
85
+ if clip.duration > 10:
86
+ raise gr.Error("Please provide or record a video shorter than 10 seconds...")
87
+
88
+
89
  split_tup = os.path.splitext(video)
90
 
91
  # extract the file name and extension
 
94
 
95
  if file_extension != ".mp4":
96
  print("Converting to mp4")
 
97
 
98
  video = file_name+".mp4"
99
  clip.write_videofile(video)