Spaces:
Sleeping
Sleeping
File size: 1,912 Bytes
a4e37d9 6394329 016496d 6394329 a4e37d9 a983a5b 016496d a983a5b a4e37d9 6394329 a4e37d9 a983a5b 6394329 a983a5b 016496d 6394329 a983a5b 016496d 6394329 a983a5b 016496d 95e8809 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
import streamlit as st
import tempfile
import os
from gully_drs_core import ball_detection, replay_utils
st.set_page_config(page_title="GullyDRS β LBW Review", layout="centered")
st.title("π GullyDRS β LBW Decision Review System")
st.markdown("""
Upload a cricket match video and let AI analyze whether it's **OUT** or **NOT OUT**
based on ball trajectory, bounce point, and stump zone detection.
""")
video_file = st.file_uploader("π₯ Upload your match video", type=["mp4", "avi"])
if video_file:
tfile = tempfile.NamedTemporaryFile(delete=False)
tfile.write(video_file.read())
st.video(video_file)
if st.button("π§ Analyze Video"):
with st.spinner("Analyzing with AI..."):
result = ball_detection.analyze_video(tfile.name)
st.write(f"π Trajectory points: {len(result['trajectory'])}")
st.write(f"π Final Decision: **{result['decision']}**")
st.write(f"π Ball Speed: **{result['speed_kmh']} km/h**")
if result["bounce_point"]:
st.info(f"π Bounce detected at: {result['bounce_point']}")
if result["impact_point"]:
st.info(f"π― Impact point: {result['impact_point']}")
replay_path = replay_utils.generate_replay(
frames=result["frames"],
ball_path=result["trajectory"],
bounce_point=result["bounce_point"],
impact_point=result["impact_point"],
decision=result["decision"],
stump_zone=result["stump_zone"],
speed_kmh=result["speed_kmh"],
fps=result["fps"]
)
if replay_path and os.path.exists(replay_path):
st.success("β
Replay generated successfully!")
st.video(replay_path)
else:
st.error("β οΈ Replay generation failed or produced no video.") |