Spaces:
Running
Running
Download fetch_assets.py from FineEnvs/PortSimEnv: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/FineEnvs/PortSimEnv/resolve/main/fetch_assets.py
- Command line
-
hf download hf://spaces/FineEnvs/PortSimEnv/fetch_assets.py
-
curl -L -o fetch_assets.py https://huggingface.co/spaces/FineEnvs/PortSimEnv/resolve/main/fetch_assets.py
1.04 kB
| """Build step: download the binary assets from the public bucket (twin data into the installed viewer, the | |
| gzipped train pack into /app/tasks). A Docker Space build copies LFS pointer files, so binaries can't come from the | |
| Space repo.""" | |
| import pathlib | |
| import urllib.request | |
| import berth_openenv | |
| twin = pathlib.Path(berth_openenv.__file__).parent / "web" / "twin" | |
| files = {"twin/" + n: twin / n for n in ['twin.json.gz', 'terrain.png', 'cover.png', 'scenery.json.gz', 'surface.webp']} | |
| files.update({p: pathlib.Path("/app") / p for p in ['tasks/dock-v1-train/tasks.jsonl.gz']}) | |
| for remote, local in files.items(): | |
| if local.is_file(): | |
| continue | |
| local.parent.mkdir(parents=True, exist_ok=True) | |
| with urllib.request.urlopen("https://huggingface.co/buckets/FineEnvs/PortSimEnv/resolve/" + remote, timeout=120) as r: | |
| body = r.read() | |
| if body.startswith(b"version https://git-lfs") or len(body) < 1000: | |
| raise SystemExit("bad download for " + remote) | |
| local.write_bytes(body) | |
| print(remote, len(body)) | |