Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from gully_drs_core import ball_detection, replay_utils | |
| def process_lbw_detection(uploaded_video_file): | |
| try: | |
| # Process the uploaded video for LBW detection | |
| result_clip_path, decision = ball_detection.process_lbw_detection(uploaded_video_file) | |
| return result_clip_path, decision | |
| except Exception as e: | |
| return None, f"Error during LBW detection: {e}" | |
| def create_lbw_ui(): | |
| with gr.Blocks() as demo: | |
| gr.Markdown("### π GullyDRS - AI Powered Gully Cricket Review System") | |
| # File upload component, we can use `gr.File()` for video upload | |
| uploaded_video_file = gr.File(label="Upload a Match Video", type="filepath", interactive=True) | |
| # Process button and output components | |
| with gr.Row(): | |
| process_btn = gr.Button("π¨ Start LBW Detection") | |
| result_clip = gr.Video(label="Replay with LBW Decision", elem_id="result_video") | |
| decision_output = gr.Textbox(label="LBW Decision", interactive=False) | |
| # Link button click to processing function | |
| process_btn.click( | |
| fn=process_lbw_detection, | |
| inputs=[uploaded_video_file], | |
| outputs=[result_clip, decision_output] | |
| ) | |
| return demo | |
| # Launch the Gradio UI for LBW review | |
| demo = create_lbw_ui() | |
| demo.launch(share=True) # Using share=True to allow public URL | |