Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,38 +1,34 @@
|
|
| 1 |
-
|
| 2 |
-
from umpire_decision import simulate_umpire_decision
|
| 3 |
-
from drs_review import analyze_drs
|
| 4 |
-
from final_decision import compare_decisions
|
| 5 |
-
|
| 6 |
-
def lbw_decision_app(pitch_zone, shot_offered, impact_zone, ball_tracking):
|
| 7 |
-
# Step 1 - On-field
|
| 8 |
-
onfield = simulate_umpire_decision(pitch_zone, shot_offered, impact_zone, ball_tracking)
|
| 9 |
-
|
| 10 |
-
# Step 2 - DRS
|
| 11 |
-
drs_result = analyze_drs(ball_tracking)
|
| 12 |
-
|
| 13 |
-
# Step 3 - Final Comparison
|
| 14 |
-
final = compare_decisions(onfield, drs_result)
|
| 15 |
-
|
| 16 |
-
return f"""🏏 **On-field Decision**: {onfield['decision']}
|
| 17 |
-
📌 Reason: {onfield['reason']}
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
|
| 25 |
-
fn=
|
| 26 |
-
inputs=
|
| 27 |
-
|
| 28 |
-
gr.
|
| 29 |
-
gr.
|
| 30 |
-
gr.
|
| 31 |
],
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
description="Simulates on-field umpire call and DRS-based final decision."
|
| 35 |
)
|
| 36 |
|
|
|
|
|
|
|
| 37 |
if __name__ == "__main__":
|
| 38 |
-
|
|
|
|
| 1 |
+
# lbw_review_system/app.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
import gradio as gr
|
| 4 |
+
from upload_review import analyze_uploaded_video
|
| 5 |
+
from live_review import analyze_live_video
|
| 6 |
+
|
| 7 |
+
upload_interface = gr.Interface(
|
| 8 |
+
fn=analyze_uploaded_video,
|
| 9 |
+
inputs=gr.Video(label="Upload LBW Appeal Video"),
|
| 10 |
+
outputs=[
|
| 11 |
+
gr.Textbox(label="Final Decision"),
|
| 12 |
+
gr.Textbox(label="Summary Explanation"),
|
| 13 |
+
gr.Video(label="Annotated Replay")
|
| 14 |
+
],
|
| 15 |
+
title="Page 1: Upload LBW Review",
|
| 16 |
+
description="DRS-based LBW decision system with video analysis and annotated verdict."
|
| 17 |
+
)
|
| 18 |
|
| 19 |
+
live_interface = gr.Interface(
|
| 20 |
+
fn=analyze_live_video,
|
| 21 |
+
inputs=gr.Video(label="Live Buffered Camera Feed (4–6s)"),
|
| 22 |
+
outputs=[
|
| 23 |
+
gr.Textbox(label="Live Decision"),
|
| 24 |
+
gr.Textbox(label="Explanation"),
|
| 25 |
+
gr.Video(label="Annotated Replay")
|
| 26 |
],
|
| 27 |
+
title="Page 2: Live LBW Review",
|
| 28 |
+
description="On-field LBW review based on live buffer feed."
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
+
app = gr.TabbedInterface([upload_interface, live_interface], ["Upload LBW Review", "Live LBW Review"])
|
| 32 |
+
|
| 33 |
if __name__ == "__main__":
|
| 34 |
+
app.launch()
|