import gradio as gr | |
from ultralytics import YOLO | |
def run(source): | |
global model | |
res = model(source, conf=.5, iou=.5) | |
res_plotted = res[0].plot() | |
return res_plotted | |
model = YOLO("yolov8n-nckh2023.pt") # Select YOLO model | |
gr.Interface( | |
run, | |
inputs=gr.Image(label="Upload image", type="filepath"), | |
outputs=gr.Image(label="Your result"), | |
title="Motorcyclist, helmet, and license plate detection", | |
).launch() | |