Download grid_map/map_loader.py from build-small-hackathon/phantom-grid: direct link, hf CLI and curl.
- Browser
- Download file 767 Bytes
-
https://huggingface.co/spaces/build-small-hackathon/phantom-grid/resolve/4f670ea00a0db95a9e7dc6d80aa620e07d0e048f/grid_map/map_loader.py
- Command line
-
hf download hf://spaces/build-small-hackathon/phantom-grid@4f670ea00a0db95a9e7dc6d80aa620e07d0e048f/grid_map/map_loader.py
-
curl -L -o map_loader.py https://huggingface.co/spaces/build-small-hackathon/phantom-grid/resolve/4f670ea00a0db95a9e7dc6d80aa620e07d0e048f/grid_map/map_loader.py
767 Bytes
| from __future__ import annotations | |
| from pathlib import Path | |
| from config import load_settings | |
| from .storage import read_json | |
| def load_map_metadata() -> dict: | |
| settings = load_settings() | |
| return read_json(settings.map_metadata_path) | |
| def image_for_layer(layer: str) -> str: | |
| settings = load_settings() | |
| metadata = load_map_metadata() | |
| images = metadata.get("images", {}) | |
| if layer not in images: | |
| raise KeyError(f"Unknown map layer: {layer}") | |
| # Processed metadata may store Windows-style separators; normalize so the | |
| # paths resolve on Linux (e.g. inside a Docker Space) as well. | |
| path = Path(str(images[layer]).replace("\\", "/")) | |
| if not path.is_absolute(): | |
| path = settings.project_root / path | |
| return str(path) | |