Ahsen Khaliq commited on
Commit
15fb875
1 Parent(s): 0785038

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -19,15 +19,18 @@ def inference(video, text):
19
  # The frame images will be stored in video_frames
20
  video_frames = []
21
  # Open the video file
 
22
  capture = cv2.VideoCapture(video)
23
  fps = capture.get(cv2.CAP_PROP_FPS)
24
 
25
  current_frame = 0
26
  # Read the current frame
27
  ret, frame = capture.read()
28
-
29
- # Convert it to a PIL image (required for CLIP) and store it
30
- video_frames.append(Image.fromarray(frame[:, :, ::-1]))
 
 
31
 
32
 
33
  # Print some statistics
 
19
  # The frame images will be stored in video_frames
20
  video_frames = []
21
  # Open the video file
22
+
23
  capture = cv2.VideoCapture(video)
24
  fps = capture.get(cv2.CAP_PROP_FPS)
25
 
26
  current_frame = 0
27
  # Read the current frame
28
  ret, frame = capture.read()
29
+ while ret:
30
+ ret,frame = vidcap.read()
31
+ print('Read a new frame: ', ret)
32
+ current_frame += 1
33
+ video_frames.append(Image.fromarray(frame[:, :, ::-1]))
34
 
35
 
36
  # Print some statistics