Spaces:
Paused
Paused
Download patch-workspace-base.py from Rovatiana/MesProFace: direct link, hf CLI and curl.
- Browser
- Download file 666 Bytes
-
https://huggingface.co/spaces/Rovatiana/MesProFace/resolve/main/patch-workspace-base.py
- Command line
-
hf download hf://spaces/Rovatiana/MesProFace/patch-workspace-base.py
-
curl -L -o patch-workspace-base.py https://huggingface.co/spaces/Rovatiana/MesProFace/resolve/main/patch-workspace-base.py
666 Bytes
| #!/usr/bin/env python3 | |
| """Patch vite.config.ts to set base: '/workspace/' for HF Spaces deployment.""" | |
| import sys | |
| path = sys.argv[1] if len(sys.argv) > 1 else 'vite.config.ts' | |
| with open(path, 'r') as f: | |
| content = f.read() | |
| needle = " return {" | |
| replacement = " return {\n base: '/workspace/'," | |
| if "base: '/workspace/'" in content: | |
| print(f"Already patched: {path}") | |
| sys.exit(0) | |
| new_content = content.replace(needle, replacement, 1) | |
| if new_content == content: | |
| print(f"ERROR: Could not find '{needle}' in {path}", file=sys.stderr) | |
| sys.exit(1) | |
| with open(path, 'w') as f: | |
| f.write(new_content) | |
| print(f"Patched {path}: base=/workspace/") | |