BrainAI-1's picture
Update app.py
07e7302 verified
Raw
History Blame Contribute Delete
568 Bytes
import streamlit as st
import cv2
import numpy as np
import PIL
from ultralytics import YOLO
from camera_input_live import camera_input_live
# Load YOLO model (Download "yolov8n.pt" first if not available)
model = YOLO("yolov8n.pt")
st.title("🎥 YOLO Object Detection Live Stream")
image = camera_input_live()
if image:
uploaded_image = PIL.Image.open(image)
#uploaded_image_cv = cv2.cvtColor(np.array(uploaded_image), cv2.COLOR_RGB2BGR)
result = model(uploaded_image)
img_plot = result[0].plot()
st.image(img_plot, channels = "BGR")