Srikesh's picture
Create app.py
ed8ca5d verified
raw
history blame contribute delete
430 Bytes
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()