lbw_drs_app_new / app.py
dschandra's picture
Update app.py
333da55 verified
raw
history blame
1.29 kB
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()