Commit
·
f0e54b5
1
Parent(s):
053e850
Fix DATA_DIR to use function instead of module-level
Browse files
app.py
CHANGED
|
@@ -9,7 +9,12 @@ import gradio as gr
|
|
| 9 |
import plotly.graph_objects as go
|
| 10 |
import plotly.io as pio
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
METRIC_LABELS = {
|
| 15 |
"x_cm": "X (cm)",
|
|
@@ -130,9 +135,10 @@ CUSTOM_CSS = """
|
|
| 130 |
@lru_cache(maxsize=1)
|
| 131 |
def load_data():
|
| 132 |
"""Load all data files."""
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
|
|
|
| 136 |
|
| 137 |
metadata = {}
|
| 138 |
end_effector = {}
|
|
@@ -255,7 +261,7 @@ def build_interface():
|
|
| 255 |
left_poses = sum(1 for f in end_effector.values() if f and isinstance(f, dict) and f.get('left_hand'))
|
| 256 |
right_poses = sum(1 for f in end_effector.values() if f and isinstance(f, dict) and f.get('right_hand'))
|
| 257 |
|
| 258 |
-
video_path =
|
| 259 |
|
| 260 |
# Build data for left hand
|
| 261 |
try:
|
|
|
|
| 9 |
import plotly.graph_objects as go
|
| 10 |
import plotly.io as pio
|
| 11 |
|
| 12 |
+
def get_data_dir():
|
| 13 |
+
"""Get data directory path."""
|
| 14 |
+
try:
|
| 15 |
+
return Path(__file__).parent / "data"
|
| 16 |
+
except:
|
| 17 |
+
return Path("data")
|
| 18 |
|
| 19 |
METRIC_LABELS = {
|
| 20 |
"x_cm": "X (cm)",
|
|
|
|
| 135 |
@lru_cache(maxsize=1)
|
| 136 |
def load_data():
|
| 137 |
"""Load all data files."""
|
| 138 |
+
data_dir = get_data_dir()
|
| 139 |
+
metadata_path = data_dir / "metadata.json"
|
| 140 |
+
end_effector_path = data_dir / "end_effector.json"
|
| 141 |
+
hands_2d_path = data_dir / "hands_2d.json"
|
| 142 |
|
| 143 |
metadata = {}
|
| 144 |
end_effector = {}
|
|
|
|
| 261 |
left_poses = sum(1 for f in end_effector.values() if f and isinstance(f, dict) and f.get('left_hand'))
|
| 262 |
right_poses = sum(1 for f in end_effector.values() if f and isinstance(f, dict) and f.get('right_hand'))
|
| 263 |
|
| 264 |
+
video_path = get_data_dir() / "video.mp4"
|
| 265 |
|
| 266 |
# Build data for left hand
|
| 267 |
try:
|