File size: 817 Bytes
99292ad
 
6dc9a2a
99292ad
 
6dc9a2a
 
f0e891b
 
99292ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
import gradio as gr
from ultralytics import YOLO
import spaces


@spaces.GPU
def predict_aerial_targets(input_img):
    model = YOLO("best.pt")
# Load our custom-trained aerial model
    # Run inference on the uploaded image
    results = model(input_img, imgsz=640)
    
    # Plot the bounding boxes directly onto the image
    annotated_img = results[0].plot()
    return annotated_img

# Define a simple drag-and-drop web interface
demo = gr.Interface(
    fn=predict_aerial_targets,
    inputs=gr.Image(type="pil", label="Upload Aerial/Satellite Image"),
    outputs=gr.Image(type="numpy", label="Detected Targets"),
    title="Nadir-Perspective Object Detection",
    description="Drop a satellite or drone image here to detect planes, ships, and infrastructure."
)

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