Spaces:
Running
on
Zero
Running
on
Zero
Update chatbot.py
Browse files- chatbot.py +4 -1
chatbot.py
CHANGED
@@ -40,7 +40,10 @@ def sample_frames(video_file, num_frames) :
|
|
40 |
total_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
|
41 |
fps = int(video.get(cv2.CAP_PROP_FPS))
|
42 |
# extracts 5 images/sec of video
|
43 |
-
|
|
|
|
|
|
|
44 |
interval = total_frames // num_frames
|
45 |
frames = []
|
46 |
for i in range(total_frames):
|
|
|
40 |
total_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
|
41 |
fps = int(video.get(cv2.CAP_PROP_FPS))
|
42 |
# extracts 5 images/sec of video
|
43 |
+
if (total_frames/fps) < 3:
|
44 |
+
num_frames = 12
|
45 |
+
else:
|
46 |
+
num_frames = ((total_frames//fps)*5)
|
47 |
interval = total_frames // num_frames
|
48 |
frames = []
|
49 |
for i in range(total_frames):
|