Spaces:
Sleeping
Sleeping
Update pages/live_match.py
Browse files- pages/live_match.py +4 -9
pages/live_match.py
CHANGED
|
@@ -16,7 +16,7 @@ def create_lbw_ui():
|
|
| 16 |
with gr.Blocks() as demo:
|
| 17 |
gr.Markdown("### 🎥 GullyDRS - LBW Decision Review System")
|
| 18 |
|
| 19 |
-
# Video input
|
| 20 |
video_input = gr.Video(label="Upload a Match Video", interactive=True)
|
| 21 |
|
| 22 |
# Pitch position slider
|
|
@@ -59,14 +59,9 @@ def create_lbw_ui():
|
|
| 59 |
|
| 60 |
# Download button generates a downloadable file
|
| 61 |
def download_clip(video_path):
|
| 62 |
-
if
|
| 63 |
-
return
|
| 64 |
-
|
| 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,
|
|
|
|
| 16 |
with gr.Blocks() as demo:
|
| 17 |
gr.Markdown("### 🎥 GullyDRS - LBW Decision Review System")
|
| 18 |
|
| 19 |
+
# Video input
|
| 20 |
video_input = gr.Video(label="Upload a Match Video", interactive=True)
|
| 21 |
|
| 22 |
# Pitch position slider
|
|
|
|
| 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,
|