import gradio as gr from video_processor import process_live_video, process_uploaded_video def analyze_live_video(): result_path, decision = process_live_video() return result_path, decision def analyze_uploaded_video(video): result_path, decision = process_uploaded_video(video) return result_path, decision with gr.Blocks(title="Smart LBW DRS System") as demo: gr.Markdown("# 🏏 Smart LBW DRS System") with gr.Tab("📡 Live Match Review"): gr.Markdown("Automatically captures last 10 seconds on LBW appeal and analyzes it.") live_btn = gr.Button("Analyze Last 10s") live_video = gr.Video(label="AI Annotated Replay") live_text = gr.Textbox(label="Decision", interactive=False) live_btn.click(fn=analyze_live_video, outputs=[live_video, live_text]) with gr.Tab("📤 Upload Review Clip"): gr.Markdown("Upload a short clip with an LBW appeal.") upload_input = gr.Video(label="Input Video") upload_btn = gr.Button("Analyze Upload") upload_output = gr.Video(label="AI Annotated Replay") upload_text = gr.Textbox(label="Decision", interactive=False) upload_btn.click(fn=analyze_uploaded_video, inputs=[upload_input], outputs=[upload_output, upload_text]) demo.launch()