from ultralytics import YOLO import gradio as gr from PIL import Image # Let Ultralytics auto-download YOLOv11 small weights model = YOLO("yolov11n") 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)