Spaces:
Runtime error
Runtime error
File size: 718 Bytes
defef4e 42df645 defef4e 42df645 d135789 42df645 d135789 671b2fd ed12aa1 8aeffbc ed12aa1 26d18d4 ed12aa1 8aeffbc ed12aa1 8aeffbc ed12aa1 d135789 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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()
|