Download scripts/space_audit.py from UniLat3D/Supra-Tex: direct link, hf CLI and curl.
- Browser
- Download file 2.84 kB
-
https://huggingface.co/spaces/UniLat3D/Supra-Tex/resolve/main/scripts/space_audit.py
- Command line
-
hf download hf://spaces/UniLat3D/Supra-Tex/scripts/space_audit.py
-
curl -L -o space_audit.py https://huggingface.co/spaces/UniLat3D/Supra-Tex/resolve/main/scripts/space_audit.py
2.84 kB
| #!/usr/bin/env python3 | |
| """Inspect Space settings, exact model inventories and authorized download access. | |
| This does not change the Space, download tensor payloads or run model inference. | |
| Authentication comes from HF_TOKEN or the local Hugging Face login cache. | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import os | |
| from pathlib import Path | |
| import sys | |
| ROOT = Path(__file__).resolve().parents[1] | |
| sys.path.insert(0, str(ROOT)) | |
| def main() -> int: | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--space", default="UniLat3D/Supra-Tex") | |
| parser.add_argument("--repo", default="supra3d/supra-tex") | |
| parser.add_argument("--revision") | |
| parser.add_argument("--output", type=Path, default=ROOT / ".deployment-evidence/deployment-audit.json") | |
| args = parser.parse_args() | |
| # The desktop runtime and the user's terminal can have different cache roots. | |
| # Record only the cache path in local evidence; no token enters the repository. | |
| local_state = ROOT / ".deployment-evidence/deployment-state.json" | |
| if local_state.is_file() and not os.environ.get("HF_TOKEN"): | |
| cache = json.loads(local_state.read_text()).get("auth_cache") | |
| if cache: | |
| os.environ.setdefault("HF_HOME", cache) | |
| from huggingface_hub import HfApi, get_token | |
| from hf_space.audit import audit_sources | |
| from scripts.install_runtime import NATTEN_VERSION | |
| api = HfApi() | |
| account = api.whoami()["name"] if get_token() else None | |
| space = api.space_info(args.space) | |
| arguments = ["--repo", args.repo, "--with-rmbg"] | |
| if args.revision: | |
| arguments.extend(["--revision", args.revision]) | |
| models = audit_sources(arguments) | |
| files = [item.rfilename for item in space.siblings] | |
| report = { | |
| "authenticated_account": account, | |
| "space": {"id": args.space, "commit": space.sha, | |
| "configuration": space.card_data.to_dict() if space.card_data else {}, | |
| "runtime": space.runtime.raw, "files": files}, | |
| "supplied_source_runtime": {"python": "3.10", "torch": "2.6.0+cu124", | |
| "natten": NATTEN_VERSION}, | |
| "local_app_entrypoint_present": (ROOT / "app.py").is_file(), | |
| "remote_app_entrypoint_present": "app.py" in files, | |
| "models": models, | |
| "validation_limits": ["No tensor payloads downloaded", "Native CUDA builds not tested", | |
| "ZeroGPU compatibility not established", "Full image-to-GLB inference not run"], | |
| } | |
| args.output.parent.mkdir(parents=True, exist_ok=True) | |
| args.output.write_text(json.dumps(report, indent=2) + "\n", encoding="utf-8") | |
| print(json.dumps(report, indent=2)) | |
| return 0 if models["ok"] and "app.py" in files else 2 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |