Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from video_utils import process_video
|
3 |
+
from lbw_logic import decide_lbw
|
4 |
+
|
5 |
+
def analyze_and_decide(video):
|
6 |
+
prediction_path, replay_path, analysis_data = process_video(video)
|
7 |
+
decision = decide_lbw(analysis_data)
|
8 |
+
return decision, prediction_path, replay_path
|
9 |
+
|
10 |
+
with gr.Blocks() as demo:
|
11 |
+
gr.Markdown("## 🏏 LBW Analysis App - Upload or Record Video")
|
12 |
+
|
13 |
+
video_input = gr.Video(label="Upload or Record Delivery Video", source="upload", format="mp4")
|
14 |
+
|
15 |
+
with gr.Row():
|
16 |
+
decision_out = gr.Textbox(label="Decision: OUT or NOT OUT")
|
17 |
+
prediction_vid = gr.Video(label="Predicted Trajectory Video")
|
18 |
+
analysis_vid = gr.Video(label="Analysis Replay")
|
19 |
+
|
20 |
+
btn = gr.Button("Analyze")
|
21 |
+
btn.click(analyze_and_decide, inputs=video_input, outputs=[decision_out, prediction_vid, analysis_vid])
|
22 |
+
|
23 |
+
demo.launch()
|