Spaces:
Sleeping
Sleeping
File size: 1,475 Bytes
11d77f4 bfdbdc1 11d77f4 bfdbdc1 11d77f4 bfdbdc1 11d77f4 dd8029e bfdbdc1 11d77f4 | 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 27 28 29 30 31 32 33 34 35 36 | import gradio as gr
from video_utils import process_video
from lbw_logic import decide_lbw
def analyze_and_decide(video):
if video is None:
return "Please upload or record a video", None, None
prediction_path, replay_path, analysis_data = process_video(video)
decision = decide_lbw(analysis_data)
return decision, prediction_path, replay_path
with gr.Blocks() as demo:
gr.Markdown("## 🏏 LBW Decision System")
with gr.Tab("Upload Video"):
upload_video = gr.Video(label="Upload Delivery Video")
upload_output = gr.Textbox(label="Decision")
upload_pred = gr.Video(label="Predicted Trajectory")
upload_replay = gr.Video(label="Replay Video")
upload_btn = gr.Button("Analyze Uploaded Video")
upload_btn.click(analyze_and_decide, inputs=upload_video,
outputs=[upload_output, upload_pred, upload_replay])
with gr.Tab("Live Capture (Record & Upload)"):
gr.Markdown("🎥 Record a video using your webcam and upload it here.")
live_video = gr.Video(label="Record and Upload Live Delivery")
live_output = gr.Textbox(label="Decision")
live_pred = gr.Video(label="Predicted Trajectory")
live_replay = gr.Video(label="Replay Video")
live_btn = gr.Button("Analyze Live Video")
live_btn.click(analyze_and_decide, inputs=live_video,
outputs=[live_output, live_pred, live_replay])
demo.launch()
|