Spaces:
Sleeping
Sleeping
Download src/features/feature_store.py from koushik2109/mindscope-Model: direct link, hf CLI and curl.
- Browser
- Download file 391 Bytes
-
https://huggingface.co/spaces/koushik2109/mindscope-Model/resolve/main/src/features/feature_store.py
- Command line
-
hf download hf://spaces/koushik2109/mindscope-Model/src/features/feature_store.py
-
curl -L -o feature_store.py https://huggingface.co/spaces/koushik2109/mindscope-Model/resolve/main/src/features/feature_store.py
391 Bytes
| import numpy as np | |
| from pathlib import Path | |
| from typing import Any, Dict | |
| def save_features(path: Path, features: Dict[str, Any]) -> None: | |
| path.parent.mkdir(parents=True, exist_ok=True) | |
| np.savez_compressed(path, **features) | |
| def load_features(path: Path) -> Dict[str, np.ndarray]: | |
| loaded = np.load(path, allow_pickle=True) | |
| return {key: loaded[key] for key in loaded.files} | |