File size: 568 Bytes
85f48bd
 
 
288cbf7
810f96b
51e18f3
85f48bd
810f96b
 
85f48bd
810f96b
85f48bd
 
51e18f3
07e7302
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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")