SuriRaja's picture
Update app.py
063b4f7 verified
raw
history blame contribute delete
776 Bytes
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()