freddyaboulton HF staff commited on
Commit
1e61aa0
·
verified ·
1 Parent(s): 4de757b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -40,7 +40,10 @@ SUBSAMPLE = 2
40
  def stream_object_detection(video, conf_threshold):
41
  cap = cv2.VideoCapture(video)
42
 
 
 
43
  iterating = True
 
44
  batch = []
45
  width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) // 2
46
  height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) // 2
@@ -123,4 +126,4 @@ with gr.Blocks() as app:
123
  inputs=[video])
124
 
125
  if __name__ == '__main__':
126
- app.launch()
 
40
  def stream_object_detection(video, conf_threshold):
41
  cap = cv2.VideoCapture(video)
42
 
43
+ fps = int(cap.get(cv2.CAP_PROP_FPS))
44
+
45
  iterating = True
46
+ desired_fps = fps // SUBSAMPLE
47
  batch = []
48
  width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) // 2
49
  height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) // 2
 
126
  inputs=[video])
127
 
128
  if __name__ == '__main__':
129
+ app.launch()