Spaces:
Sleeping
Sleeping
File size: 463 Bytes
8c104ff |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import cv2
import gradio as gr
from ultralytics import YOLO
model = YOLO("best.pt")
def predict_drone(img):
img_copy = img.copy()
result = model(img_copy)
for data in result[0].boxes.data:
xmin,ymin,xmax,ymax = int(data[0]),int(data[1]),int(data[2]),int(data[3])
cv2.rectangle(img_copy,(xmin,ymin),(xmax,ymax),(0,255,0),2)
return img_copy
image_interface=gr.Interface(fn = predict_drone,inputs="image",outputs="image")
image_interface.launch() |