File size: 585 Bytes
0dcb80d
36d27d7
0dcb80d
 
36d27d7
0dcb80d
36d27d7
 
0dcb80d
36d27d7
e28d8f1
36d27d7
 
 
 
0dcb80d
36d27d7
 
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
23
24
25
26
import gradio as gr
import torch
import cv2
import numpy as np
from ultralytics import YOLO

def load_model(model_path="DDR.pt"):
    return YOLO(model_path)

model = load_model()

def predict(image):
    results = model(image, conf=0.01)
    pred_img = results[0].plot()  # Visualize detections
    return pred_img

iface = gr.Interface(
    fn=predict,
    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()