Raffael-Kultyshev commited on
Commit
d7e3453
·
1 Parent(s): 96e68cd

Add simple sidebar with stats

Browse files
Files changed (1) hide show
  1. app.py +35 -4
app.py CHANGED
@@ -1,16 +1,47 @@
1
  """
2
- Minimal test version
3
  """
4
  import gradio as gr
 
5
  from pathlib import Path
6
 
7
  DATA_DIR = Path(__file__).parent / "data"
8
  video_path = DATA_DIR / "video.mp4"
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  with gr.Blocks() as demo:
11
- gr.Markdown("# Test")
12
- gr.Video(value=str(video_path) if video_path.exists() else None)
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  if __name__ == "__main__":
15
  demo.launch()
16
-
 
1
  """
2
+ Dynamic Intelligence - Human Demo Visualizer
3
  """
4
  import gradio as gr
5
+ import json
6
  from pathlib import Path
7
 
8
  DATA_DIR = Path(__file__).parent / "data"
9
  video_path = DATA_DIR / "video.mp4"
10
 
11
+ # Load data safely
12
+ try:
13
+ metadata = json.load(open(DATA_DIR / "metadata.json"))
14
+ end_effector = json.load(open(DATA_DIR / "end_effector.json"))
15
+ hands_2d = json.load(open(DATA_DIR / "hands_2d.json"))
16
+
17
+ total_frames = len(metadata.get('poses', []))
18
+ fps = metadata.get('fps', 60)
19
+ hand_detection_rate = len(hands_2d) / max(1, total_frames) * 100
20
+ left_poses = sum(1 for f in end_effector.values() if f and isinstance(f, dict) and f.get('left_hand'))
21
+ right_poses = sum(1 for f in end_effector.values() if f and isinstance(f, dict) and f.get('right_hand'))
22
+ except:
23
+ total_frames = 0
24
+ fps = 60
25
+ hand_detection_rate = 0
26
+ left_poses = 0
27
+ right_poses = 0
28
+
29
  with gr.Blocks() as demo:
30
+ gr.Markdown("# 🤖 Dynamic Intelligence - Human Demo Visualizer")
31
+
32
+ with gr.Row():
33
+ with gr.Column(scale=1):
34
+ gr.Markdown(f"""
35
+ **Stats:**
36
+ - Frames: {total_frames:,}
37
+ - Hand detection: {hand_detection_rate:.1f}%
38
+ - Left poses: {left_poses}
39
+ - Right poses: {right_poses}
40
+ - FPS: {fps}
41
+ """)
42
+ with gr.Column(scale=2):
43
+ gr.Markdown("### RGB Video")
44
+ gr.Video(value=str(video_path) if video_path.exists() else None)
45
 
46
  if __name__ == "__main__":
47
  demo.launch()