File size: 496 Bytes
5c0c8f6 0ed888f 5c0c8f6 0ed888f 5c0c8f6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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)
|