Update app.py
Browse files17 unmodified lines1819202122232425262728293031326 unmodified lines3940414243444517 unmodified lines# Function to process and display videodef process_video(source, model, options=None):if source == 'Local':cap = cv2.VideoCapture(0) # Local webcamelse: # YouTube sourcecap = CamGear(source=source, stream_mode=True, logging=True, **options).start()FRAME_WINDOW = st.empty()while True:if source == 'Local':ret, frame = cap.read()if not ret:break6 unmodified linesframe = plot_boxes(frame, model)FRAME_WINDOW.image(frame)if source == 'Local':cap.release()# Load the YOLOv9 model17 unmodified lines1819202122232425262728293031326 unmodified lines3940414243444517 unmodified lines# Function to process and display videodef process_video(source, model, options=None):if source == 'Webcam':cap = cv2.VideoCapture(0) # webcamelse: # YouTube sourcecap = CamGear(source=source, stream_mode=True, logging=True, **options).start()FRAME_WINDOW = st.empty()while True:if source == 'Webcam':ret, frame = cap.read()if not ret:break6 unmodified linesframe = plot_boxes(frame, model)FRAME_WINDOW.image(frame)if source == 'Webcam':cap.release()# Load the YOLOv9 model
app.py+4-4