satwik24's picture
Update app.py
fd50c7d verified
raw
history blame
494 Bytes
import cv2
import torch
import numpy as np
import gradio as gr
from PIL import Image
from ultralytics import YOLO
model = YOLO("https://github.com/ultralytics/assets/releases/download/v8.3.0/yolov8n.pt")
def detect_objects(image):
results = model(image)
return results[0].plot()
gr.Interface(
fn=detect_objects,
inputs=gr.Image(sources="webcam", type="numpy", label="Live Webcam"),
outputs=gr.Image(type="numpy", label="Detection Output"),
live=True
).launch()