object-detector / app.py
JermaineAI's picture
Upload 3 files
d05537a verified
import gradio as gr
from ultralytics import YOLO
from PIL import Image
model = YOLO("best.pt")
def detect(image):
results = model(image)
return results[0].plot()
demo = gr.Interface(
fn=detect,
inputs=gr.Camera(label="Take a photo with webcam"), # Enable camera input
outputs=gr.Image(label="Detection Result"),
title="Live Object Detection (Phone–Person–Bottle)",
description="Click to capture from webcam and detect objects in real-time."
)
demo.launch()