File size: 430 Bytes
ed8ca5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()