yolov11n / app.py
monstxr's picture
Update app.py
0ed888f verified
raw
history blame
496 Bytes
from ultralytics import YOLO
import gradio as gr
from PIL import Image
# Load YOLOv11 small model (CPU, auto-download)
model = YOLO("yolov11n") # <- no local file needed
def detect(image):
results = model.predict(source=image, device="cpu")
annotated = results[0].plot()
return Image.fromarray(annotated)
gr.Interface(
fn=detect,
inputs=gr.Image(type="pil"),
outputs=gr.Image(type="pil"),
title="YOLOv11 CPU Demo"
).launch(server_name="0.0.0.0", server_port=7860)