File size: 776 Bytes
179bd59
 
0f72c7b
f0568f6
0f72c7b
 
 
 
 
 
 
 
 
 
 
 
 
063b4f7
0f72c7b
 
f0568f6
0f72c7b
 
179bd59
063b4f7
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
from model import predict_defect
from utils import extract_frames
import os

DATA_DIR = "Data"

def get_video_choices():
    return [os.path.join(DATA_DIR, f) for f in os.listdir(DATA_DIR) if f.endswith(".mp4")]

def analyze_selected_video(video_path):
    frames = extract_frames(video_path)
    results = [predict_defect(frame) for frame in frames]
    return results

demo = gr.Interface(
    fn=analyze_selected_video,
    inputs=gr.Dropdown(choices=get_video_choices(), label="Select Drone Video"),
    outputs=gr.Gallery(label="Detected Road Defects"),
    title="Drone-based Road Defect Detection",
    description="Highlight road defects (cracks, potholes, misalignments) in red using video frames."
)

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