File size: 757 Bytes
0f9928e
 
 
edb09e9
0f9928e
 
 
 
edb09e9
 
0f9928e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
edb09e9
0f9928e
 
 
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
28
29
30
31
import gradio as gr
from ultralytics import YOLO
import numpy as np
import os

# Load YOLO model
model = YOLO('./best.pt')

example_list = [["examples/" + example] for example in os.listdir("examples")]

def process_image(input_image):
    if input_image is not None:
        results = model(input_image)

        for r in results:
            im_array = r.plot()
            im_array = im_array.astype(np.uint8)
            return im_array

# Create Gradio Interface
iface = gr.Interface(
    fn=process_image,
    inputs=gr.Image(),
    outputs=gr.Image(),  # Specify output as Gradio Image
    title="YOLOv8-obb aerial detection",
    description="YOLOv8-obb trained on DOTAv1.5",
    examples=example_list)

# Launch the Gradio interface
iface.launch()