Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from utils import extract_frames
|
3 |
+
from model import predict_defect
|
4 |
+
|
5 |
+
def analyze_video(video):
|
6 |
+
frames = extract_frames(video.name)
|
7 |
+
results = [predict_defect(frame) for frame in frames]
|
8 |
+
return results
|
9 |
+
|
10 |
+
demo = gr.Interface(
|
11 |
+
fn=analyze_video,
|
12 |
+
inputs=gr.Video(label="Upload Drone Video"),
|
13 |
+
outputs=gr.Gallery(label="Detected Road Defects").style(grid=[3]),
|
14 |
+
title="Drone-based Road Defect Detection",
|
15 |
+
description="Upload drone footage to identify and highlight road surface defects."
|
16 |
+
)
|
17 |
+
|
18 |
+
if __name__ == "__main__":
|
19 |
+
demo.launch()
|