DSatishchandra commited on
Commit
abbdb28
·
verified ·
1 Parent(s): ce99462

Update pages/live_match.py

Browse files
Files changed (1) hide show
  1. pages/live_match.py +10 -5
pages/live_match.py CHANGED
@@ -16,8 +16,8 @@ def create_lbw_ui():
16
  with gr.Blocks() as demo:
17
  gr.Markdown("### 🎥 GullyDRS - LBW Decision Review System")
18
 
19
- # Video input (removed type parameter)
20
- video_input = gr.Video(label="Upload or Record a Match Video", source="upload", interactive=True)
21
 
22
  # Pitch position slider
23
  pitch_position = gr.Slider(minimum=0, maximum=100, value=50, step=1, label="Set Wickets Pitch (%)")
@@ -59,9 +59,14 @@ def create_lbw_ui():
59
 
60
  # Download button generates a downloadable file
61
  def download_clip(video_path):
62
- if video_path and os.path.exists(video_path):
63
- return gr.File(label="Download Replay Clip", value=video_path)
64
- return None
 
 
 
 
 
65
 
66
  download_btn.click(
67
  fn=download_clip,
 
16
  with gr.Blocks() as demo:
17
  gr.Markdown("### 🎥 GullyDRS - LBW Decision Review System")
18
 
19
+ # Video input (removed source parameter)
20
+ video_input = gr.Video(label="Upload a Match Video", interactive=True)
21
 
22
  # Pitch position slider
23
  pitch_position = gr.Slider(minimum=0, maximum=100, value=50, step=1, label="Set Wickets Pitch (%)")
 
59
 
60
  # Download button generates a downloadable file
61
  def download_clip(video_path):
62
+ if video_input is None:
63
+ return None, "Please upload a video.", None, None
64
+ if pitch_position is None:
65
+ pitch_position = 50 # Default pitch position
66
+ result_clip_path, decision, ball_path_3d = ball_detection.process_lbw_detection(video_input, pitch_position)
67
+ if not result_clip_path:
68
+ return None, "Failed to process video.", None, None
69
+ return result_clip_path, decision, ball_path_3d, None
70
 
71
  download_btn.click(
72
  fn=download_clip,