Ahsen Khaliq commited on
Commit
9e60d26
1 Parent(s): 531c25c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -12
app.py CHANGED
@@ -42,18 +42,14 @@ def inference(video, text):
42
  fps = capture.get(cv2.CAP_PROP_FPS)
43
 
44
  current_frame = 0
45
- while capture.isOpened():
46
- # Read the current frame
47
- ret, frame = capture.read()
48
-
49
- # Convert it to a PIL image (required for CLIP) and store it
50
- if ret == True:
51
- video_frames.append(Image.fromarray(frame[:, :, ::-1]))
52
- else:
53
- break
54
-
55
- # Skip N frames
56
- capture.set(cv2.CAP_PROP_POS_FRAMES, current_frame)
57
 
58
  # Print some statistics
59
  print(f"Frames extracted: {len(video_frames)}")
 
42
  fps = capture.get(cv2.CAP_PROP_FPS)
43
 
44
  current_frame = 0
45
+ # Read the current frame
46
+ ret, frame = capture.read()
47
+
48
+ # Convert it to a PIL image (required for CLIP) and store it
49
+ if ret == True:
50
+ video_frames.append(Image.fromarray(frame[:, :, ::-1]))
51
+ else:
52
+ break
 
 
 
 
53
 
54
  # Print some statistics
55
  print(f"Frames extracted: {len(video_frames)}")