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 # Set the title of the app st.title("Live Fire Detection App") cap = cv2.VideoCapture(0) # 0 for default camera if not cap.isOpened(): print("Error: Could not open video capture device.") exit() while True: ret, frame = cap.read() if not ret: print("Error: Could not read frame.") break # Process the frame here (e.g., display, save, analyze) cv2.imshow('Frame', frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows()