File size: 622 Bytes
0dcb80d
d06ef8c
0dcb80d
 
e28d8f1
d06ef8c
 
 
 
 
 
0dcb80d
36d27d7
bbd65ca
0dcb80d
36d27d7
 
 
0dcb80d
 
36d27d7
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from ultralytics import YOLO
import cv2
import numpy as np

def detect_objects(image):
    model = YOLO("./ddr.pt")  # Load the trained model
    results = model(image, conf=0.10)  # Run inference with confidence threshold
    
    output_image = results[0].plot()  # Get the image with bounding boxes
    return output_image

iface = gr.Interface(
    fn=detect_objects,
    inputs=gr.Image(type="numpy"),
    outputs=gr.Image(type="numpy"),
    title="DDR-Detection",
    description="Upload an image, and the model will detect objects using YOLO11.",
)

if __name__ == "__main__":
    iface.launch()