Dyra1204 commited on
Commit
f6191bf
·
verified ·
1 Parent(s): 5563361

Upload scripts/push_to_hf_space.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/push_to_hf_space.py +7 -3
scripts/push_to_hf_space.py CHANGED
@@ -17,7 +17,9 @@ from huggingface_hub.errors import HfHubHTTPError
17
 
18
  def main():
19
  repo_id = os.environ.get("HF_SPACE_REPO_ID") or os.environ.get("HF_SPACE_REPO") or "Dyra1204/BiasGuard-Pro"
20
- skip_dirs = {"models", "results", ".git", "__pycache__", ".venv", ".cache", ".pytest_cache"}
 
 
21
 
22
  # Auth: prefer explicit env var, otherwise use cached token from `hf auth login`.
23
  token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGINGFACE_HUB_TOKEN")
@@ -52,9 +54,11 @@ def main():
52
  # Walk repository and upload files (skip ignored directories)
53
  to_upload = []
54
  for root, dirs, files in os.walk("."):
55
- # mutate dirs in-place to skip unwanted and hidden directories
56
- dirs[:] = [d for d in dirs if d not in skip_dirs and not d.startswith(".")]
57
  for fn in files:
 
 
58
  if fn.endswith((".pyc", ".pyo", ".log")):
59
  continue
60
  # skip hidden cache files in repo root
 
17
 
18
  def main():
19
  repo_id = os.environ.get("HF_SPACE_REPO_ID") or os.environ.get("HF_SPACE_REPO") or "Dyra1204/BiasGuard-Pro"
20
+ # User-requested: push everything except venv + pytest cache.
21
+ # We also skip a few always-unwanted runtime folders.
22
+ skip_dirs = {".venv", ".pytest_cache", ".git", "__pycache__", ".cache"}
23
 
24
  # Auth: prefer explicit env var, otherwise use cached token from `hf auth login`.
25
  token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGINGFACE_HUB_TOKEN")
 
54
  # Walk repository and upload files (skip ignored directories)
55
  to_upload = []
56
  for root, dirs, files in os.walk("."):
57
+ # mutate dirs in-place to skip unwanted directories
58
+ dirs[:] = [d for d in dirs if d not in skip_dirs]
59
  for fn in files:
60
+ if fn == ".DS_Store":
61
+ continue
62
  if fn.endswith((".pyc", ".pyo", ".log")):
63
  continue
64
  # skip hidden cache files in repo root