Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,4 +32,60 @@ with gr.Blocks() as demo:
|
|
32 |
live_btn.click(analyze_and_decide, inputs=live_video,
|
33 |
outputs=[live_output, live_pred, live_replay])
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
demo.launch()
|
|
|
32 |
live_btn.click(analyze_and_decide, inputs=live_video,
|
33 |
outputs=[live_output, live_pred, live_replay])
|
34 |
|
35 |
+
with gr.Tab("Replay with Hover Analysis"):
|
36 |
+
gr.Markdown("📽️ Hover over zones to see ball behavior insights.")
|
37 |
+
gr.HTML("""
|
38 |
+
<div class="video-container" style="position: relative; max-width: 960px; margin: 20px auto;">
|
39 |
+
<video controls autoplay loop style="width: 100%;">
|
40 |
+
<source src="replay_lbw_analysis_f175cd6fa04f4ec8882b647d4763e7d5.mp4" type="video/mp4">
|
41 |
+
Your browser does not support the video tag.
|
42 |
+
</video>
|
43 |
+
|
44 |
+
<!-- Overlays -->
|
45 |
+
<div class="overlay" style="top: 70%; left: 30%; width: 80px; height: 40px;">
|
46 |
+
<div class="tooltip">Pitching: Outside Off</div>
|
47 |
+
</div>
|
48 |
+
<div class="overlay" style="top: 48%; left: 45%; width: 90px; height: 40px;">
|
49 |
+
<div class="tooltip">Impact: In-line</div>
|
50 |
+
</div>
|
51 |
+
<div class="overlay" style="top: 25%; left: 50%; width: 100px; height: 40px;">
|
52 |
+
<div class="tooltip">Wickets: Hitting</div>
|
53 |
+
</div>
|
54 |
+
|
55 |
+
<style>
|
56 |
+
.overlay {
|
57 |
+
position: absolute;
|
58 |
+
border: 2px dashed #ff0;
|
59 |
+
background-color: rgba(255, 255, 0, 0.2);
|
60 |
+
color: #000;
|
61 |
+
font-weight: bold;
|
62 |
+
padding: 4px;
|
63 |
+
border-radius: 6px;
|
64 |
+
pointer-events: all;
|
65 |
+
cursor: help;
|
66 |
+
}
|
67 |
+
.tooltip {
|
68 |
+
visibility: hidden;
|
69 |
+
width: 180px;
|
70 |
+
background-color: black;
|
71 |
+
color: #fff;
|
72 |
+
text-align: center;
|
73 |
+
border-radius: 6px;
|
74 |
+
padding: 5px 8px;
|
75 |
+
position: absolute;
|
76 |
+
z-index: 2;
|
77 |
+
bottom: 125%;
|
78 |
+
left: 50%;
|
79 |
+
margin-left: -90px;
|
80 |
+
opacity: 0;
|
81 |
+
transition: opacity 0.3s;
|
82 |
+
}
|
83 |
+
.overlay:hover .tooltip {
|
84 |
+
visibility: visible;
|
85 |
+
opacity: 1;
|
86 |
+
}
|
87 |
+
</style>
|
88 |
+
</div>
|
89 |
+
""")
|
90 |
+
|
91 |
demo.launch()
|