Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -21,13 +21,18 @@ for model_id in model_ids:
|
|
21 |
|
22 |
|
23 |
def get_frame_count(filepath):
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
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):
|