Nawinkumar15's picture
Update app.py
817ac03 verified
raw
history blame contribute delete
505 Bytes
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()