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

Revert to minimal working version

Browse files
Files changed (1) hide show
  1. app.py +6 -93
app.py CHANGED
@@ -1,103 +1,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
-
10
- def load_json_safe(path):
11
- try:
12
- with open(path, 'r') as f:
13
- return json.load(f)
14
- except:
15
- return {}
16
-
17
- # Load data with error handling
18
- try:
19
- metadata = load_json_safe(DATA_DIR / "metadata.json")
20
- end_effector = load_json_safe(DATA_DIR / "end_effector.json")
21
- hands_2d = load_json_safe(DATA_DIR / "hands_2d.json")
22
-
23
- total_frames = max(1, len(metadata.get('poses', [])))
24
- fps = metadata.get('fps', 60)
25
- hand_detection_rate = len(hands_2d) / total_frames * 100 if total_frames > 0 else 0
26
-
27
- left_poses = sum(1 for f in end_effector.values() if f and isinstance(f, dict) and f.get('left_hand'))
28
- right_poses = sum(1 for f in end_effector.values() if f and isinstance(f, dict) and f.get('right_hand'))
29
- except Exception as e:
30
- print(f"Error loading data: {e}")
31
- total_frames = 0
32
- fps = 60
33
- hand_detection_rate = 0
34
- left_poses = 0
35
- right_poses = 0
36
-
37
  video_path = DATA_DIR / "video.mp4"
38
 
39
- CUSTOM_CSS = """
40
- :root, .gradio-container, body {
41
- background-color: #050a18 !important;
42
- color: #f8fafc !important;
43
- }
44
- .side-panel {
45
- background: #0f172a;
46
- padding: 20px;
47
- border-radius: 18px;
48
- border: 1px solid #1f2b47;
49
- }
50
- .stats-card ul {
51
- list-style: none;
52
- padding: 0;
53
- margin: 0;
54
- font-size: 0.92rem;
55
- }
56
- .stats-card li {
57
- margin-bottom: 10px;
58
- color: #e2e8f0;
59
- }
60
- .stats-card span {
61
- display: inline-block;
62
- margin-right: 6px;
63
- color: #7dd3fc;
64
- }
65
- """
66
-
67
- stats_html = f"""
68
- <div class="stats-card">
69
- <ul>
70
- <li><span>Number of samples/frames:</span> {total_frames:,}</li>
71
- <li><span>Hand detection rate:</span> {hand_detection_rate:.1f}%</li>
72
- <li><span>Left hand poses:</span> {left_poses}</li>
73
- <li><span>Right hand poses:</span> {right_poses}</li>
74
- <li><span>Frames per second:</span> {fps:.1f}</li>
75
- </ul>
76
- </div>
77
- """
78
-
79
- theme = gr.themes.Soft(
80
- primary_hue="cyan", secondary_hue="blue", neutral_hue="slate"
81
- ).set(
82
- body_background_fill="#0c1424",
83
- body_text_color="#f8fafc",
84
- block_background_fill="#111a2c",
85
- )
86
-
87
- with gr.Blocks(theme=theme, css=CUSTOM_CSS) as demo:
88
- gr.Markdown("# 🤖 Dynamic Intelligence - Human Demo Visualizer")
89
- gr.Markdown("Egocentric hand tracking dataset for humanoid robot training")
90
-
91
- with gr.Row(equal_height=True):
92
- with gr.Column(scale=1, min_width=260, elem_classes=["side-panel"]):
93
- gr.HTML(stats_html)
94
- with gr.Column(scale=2, min_width=640):
95
- gr.Markdown("### RGB Video")
96
- video = gr.Video(
97
- height=360,
98
- value=str(video_path) if video_path.exists() else None,
99
- show_label=False,
100
- )
101
 
102
  if __name__ == "__main__":
103
- demo.queue().launch(show_api=False)
 
 
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
+