Spaces:
Sleeping
Sleeping
| 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() |