File size: 414 Bytes
2ef9854
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

import gradio as gr
from ultralytics import YOLO

# Load model (weights must be in repo)
model = YOLO("best.pt")

def predict(image):
    results = model.predict(image, conf=0.25)
    return results[0].plot()

iface = gr.Interface(
    fn=predict,
    inputs=gr.Image(type="filepath"),
    outputs=gr.Image(type="numpy"),
    title="Pothole Detection with YOLOv8"
)

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