Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,21 +3,32 @@ 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
|
12 |
-
|
13 |
-
video_input = gr.Video(label="Upload Delivery Video") # Removed unsupported args
|
14 |
|
15 |
-
with gr.
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
demo.launch()
|
|
|
3 |
from lbw_logic import decide_lbw
|
4 |
|
5 |
def analyze_and_decide(video):
|
6 |
+
if video is None:
|
7 |
+
return "Please upload or record a video", None, None
|
8 |
+
|
9 |
prediction_path, replay_path, analysis_data = process_video(video)
|
10 |
decision = decide_lbw(analysis_data)
|
11 |
return decision, prediction_path, replay_path
|
12 |
|
13 |
with gr.Blocks() as demo:
|
14 |
+
gr.Markdown("## π LBW Decision System")
|
|
|
|
|
15 |
|
16 |
+
with gr.Tab("Upload Video"):
|
17 |
+
upload_video = gr.Video(label="Upload Delivery Video")
|
18 |
+
upload_output = gr.Textbox(label="Decision")
|
19 |
+
upload_pred = gr.Video(label="Predicted Trajectory")
|
20 |
+
upload_replay = gr.Video(label="Replay Video")
|
21 |
+
upload_btn = gr.Button("Analyze Uploaded Video")
|
22 |
+
upload_btn.click(analyze_and_decide, inputs=upload_video,
|
23 |
+
outputs=[upload_output, upload_pred, upload_replay])
|
24 |
|
25 |
+
with gr.Tab("Live Capture"):
|
26 |
+
live_video = gr.Camera(label="Record Live Delivery", type="mp4")
|
27 |
+
live_output = gr.Textbox(label="Decision")
|
28 |
+
live_pred = gr.Video(label="Predicted Trajectory")
|
29 |
+
live_replay = gr.Video(label="Replay Video")
|
30 |
+
live_btn = gr.Button("Analyze Live Video")
|
31 |
+
live_btn.click(analyze_and_decide, inputs=live_video,
|
32 |
+
outputs=[live_output, live_pred, live_replay])
|
33 |
|
34 |
demo.launch()
|