fffiloni commited on
Commit
eda2433
1 Parent(s): 70de192

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -21,13 +21,18 @@ for model_id in model_ids:
21
 
22
 
23
  def get_frame_count(filepath):
24
- video = cv2.VideoCapture(filepath)
25
- frame_count = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
26
- video.release()
 
 
27
 
28
- #LIMITS
29
- if frame_count > 24 :
30
- frame_count = 24 # limit to 24 frames to avoid cuDNN errors
 
 
 
31
  return gr.update(maximum=frame_count)
32
 
33
  def get_video_dimension(filepath):
 
21
 
22
 
23
  def get_frame_count(filepath):
24
+ if filepath is not None:
25
+ video = cv2.VideoCapture(filepath)
26
+ frame_count = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
27
+
28
+ video.release()
29
 
30
+ #LIMITS
31
+ if frame_count > 24 :
32
+ frame_count = 24 # limit to 24 frames to avoid cuDNN errors
33
+
34
+ else:
35
+ frame_count = 1
36
  return gr.update(maximum=frame_count)
37
 
38
  def get_video_dimension(filepath):