Spaces:
Runtime error
Runtime error
| from ultralytics import YOLO | |
| import gradio as gr | |
| import torch | |
| model = YOLO("best.pt") | |
| def predict(image): | |
| results = model(image) | |
| return results[0].plot() | |
| demo = gr.Interface( | |
| fn=predict, | |
| inputs=gr.Image(type="filepath", label="Upload Image"), | |
| outputs=gr.Image(label="Detection Result"), | |
| title="YOLO Object Detection", | |
| description="Upload an image and let YOLO detect objects!" | |
| ) | |
| demo.launch() | |