syedatasneem1's picture
Upload app.py
b2ed2c4 verified
import gradio as gr
from ultralytics import YOLO
from PIL import Image
det_model = YOLO("yolov8n.pt")
def detect_objects(image):
results = det_model(image)
det_img = results[0].plot()
return det_img
iface = gr.Interface(
detect_objects,
inputs=gr.Image(type="pil"),
outputs=gr.Image(type="pil"),
title="YOLOv8 Object Detection",
description="Upload an image to detect objects and see them boxed",
examples=['./image_1.jpg', './image_2.jpg', './image_3.jpg']
)
iface.launch()