Juned24 commited on
Commit
0265ff3
·
verified ·
1 Parent(s): 137e307

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -18,15 +18,15 @@ def plot_boxes(frame, model):
18
 
19
  # Function to process and display video
20
  def process_video(source, model, options=None):
21
- if source == 'Local':
22
- cap = cv2.VideoCapture(0) # Local webcam
23
  else: # YouTube source
24
  cap = CamGear(source=source, stream_mode=True, logging=True, **options).start()
25
 
26
  FRAME_WINDOW = st.empty()
27
 
28
  while True:
29
- if source == 'Local':
30
  ret, frame = cap.read()
31
  if not ret:
32
  break
@@ -39,7 +39,7 @@ def process_video(source, model, options=None):
39
  frame = plot_boxes(frame, model)
40
  FRAME_WINDOW.image(frame)
41
 
42
- if source == 'Local':
43
  cap.release()
44
 
45
  # Load the YOLOv9 model
 
18
 
19
  # Function to process and display video
20
  def process_video(source, model, options=None):
21
+ if source == 'Webcam':
22
+ cap = cv2.VideoCapture(0) # webcam
23
  else: # YouTube source
24
  cap = CamGear(source=source, stream_mode=True, logging=True, **options).start()
25
 
26
  FRAME_WINDOW = st.empty()
27
 
28
  while True:
29
+ if source == 'Webcam':
30
  ret, frame = cap.read()
31
  if not ret:
32
  break
 
39
  frame = plot_boxes(frame, model)
40
  FRAME_WINDOW.image(frame)
41
 
42
+ if source == 'Webcam':
43
  cap.release()
44
 
45
  # Load the YOLOv9 model