Tharun156 commited on
Commit
fae86e5
Β·
verified Β·
1 Parent(s): f54f126

Update hf_space/app.py

Browse files
Files changed (1) hide show
  1. hf_space/app.py +11 -1
hf_space/app.py CHANGED
@@ -65,14 +65,22 @@ def _sync_downloaded_assets(download_root: Path) -> None:
65
  ".zip",
66
  }
67
 
 
 
68
  copied = 0
 
69
  for file_path in download_root.rglob("*"):
70
  if not file_path.is_file():
71
  continue
72
  if file_path.suffix.lower() not in allowed_suffixes:
73
  continue
74
  relative = file_path.relative_to(download_root)
75
- destination = ROOT_DIR / relative
 
 
 
 
 
76
  destination.parent.mkdir(parents=True, exist_ok=True)
77
  try:
78
  shutil.copy2(file_path, destination)
@@ -82,6 +90,8 @@ def _sync_downloaded_assets(download_root: Path) -> None:
82
 
83
  if copied:
84
  print(f"[GestureLSM] Synced {copied} asset files from {download_root} to repository root")
 
 
85
 
86
 
87
 
 
65
  ".zip",
66
  }
67
 
68
+ anchor_dirs = {"ckpt", "mean_std", "datasets", "weights", "hf_assets"}
69
+
70
  copied = 0
71
+ skipped = 0
72
  for file_path in download_root.rglob("*"):
73
  if not file_path.is_file():
74
  continue
75
  if file_path.suffix.lower() not in allowed_suffixes:
76
  continue
77
  relative = file_path.relative_to(download_root)
78
+ parts = relative.parts
79
+ anchor_index = next((idx for idx, part in enumerate(parts) if part in anchor_dirs), None)
80
+ if anchor_index is None:
81
+ skipped += 1
82
+ continue
83
+ destination = ROOT_DIR / Path(*parts[anchor_index:])
84
  destination.parent.mkdir(parents=True, exist_ok=True)
85
  try:
86
  shutil.copy2(file_path, destination)
 
90
 
91
  if copied:
92
  print(f"[GestureLSM] Synced {copied} asset files from {download_root} to repository root")
93
+ elif skipped:
94
+ print(f"[GestureLSM] Skipped {skipped} files with no anchor directory match in {download_root}")
95
 
96
 
97