Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| import cv2 | |
| import numpy as np | |
| from ultralytics import YOLO | |
| # Load the YOLO model | |
| model = YOLO("best.pt") # Ensure the path to your model is correct | |
| webcamera = cv2.VideoCapture() | |
| # # webcamera.set(cv2.CAP_PROP_FRAME_WIDTH, 1920) | |
| # # webcamera.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080) | |
| # while True: | |
| # success, frame = webcamera.read() | |
| # results = model.track(frame, classes=0, conf=0.8, imgsz=480) | |
| # cv2.putText(frame, f"Total: {len(results[0].boxes)}", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2, cv2.LINE_AA) | |
| # cv2.imshow("Live Camera", results[0].plot()) | |
| # if cv2.waitKey(1) == ord('q'): | |
| # break | |
| # webcamera.release() | |
| # cv2.destroyAllWindows() | |