File size: 505 Bytes
24a2c51
ad6c417
 
817ac03
 
24a2c51
817ac03
24a2c51
817ac03
3d189fc
817ac03
 
24a2c51
817ac03
 
 
24a2c51
 
817ac03
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from ultralytics import YOLO

# ✅ Load model directly from local file (same folder as app.py)
model = YOLO("best.pt")

def predict(image):
    results = model(image)
    return results[0].plot()

iface = gr.Interface(
    fn=predict,
    inputs=gr.Image(type="pil"),
    outputs=gr.Image(type="pil", label="Detected Objects"),
    title="Roboflow YOLOv8 Detector",
    description="Upload an image to detect objects using your YOLOv8 model trained with Roboflow."
)

iface.launch()