import cv2 from ultralytics import YOLO model=YOLO("/home/kahraman/Masaüstü/HuggingFace_Models_and_Spaces/yolov8_model_on_custom_data/best.pt") source="/home/kahraman/Masaüstü/HuggingFace_Models_and_Spaces/yolov8_model_on_custom_data/cow-video-cows-mooing-and-grazing-in-a-field.mp4" cap=cv2.VideoCapture(source) while cap: ret, frame= cap.read() if not ret: break results = model(frame) cv2.imshow("img", results[0].plot()) if cv2.waitKey(1) & 0xFF == ord("q"): break cap.release() cv2.destroyAllWindows()