dschandra commited on
Commit
e54e925
·
verified ·
1 Parent(s): 7bbe9fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -32
app.py CHANGED
@@ -1,38 +1,34 @@
1
- import gradio as gr
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
- 🧪 **DRS Verdict**: {'CONFIRMED ✅' if final['confirmed'] else 'OVERTURNED ❌'}
20
- 📌 DRS Analysis: {drs_result['reason']}
21
-
22
- ✅ **Final Decision**: {final['final_decision']}"""
 
 
 
 
 
 
 
 
 
 
 
23
 
24
- iface = gr.Interface(
25
- fn=lbw_decision_app,
26
- inputs=[
27
- gr.Radio(["In Line", "Outside Off", "Outside Leg"], label="Pitch Location"),
28
- gr.Radio(["Yes", "No"], label="Was Shot Offered?"),
29
- gr.Radio(["In Line", "Outside Off", "Outside Leg"], label="Impact Zone"),
30
- gr.Textbox(label="Ball Tracking Data (JSON format)", placeholder='{"pitching": "in line", "impact": "in line", "trajectory": "hitting"}'),
31
  ],
32
- outputs="markdown",
33
- title="Smart LBW Decision Review System",
34
- description="Simulates on-field umpire call and DRS-based final decision."
35
  )
36
 
 
 
37
  if __name__ == "__main__":
38
- iface.launch()
 
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()