Spaces:
Running
Running
| """Storage backend factory.""" | |
| from server import config | |
| from server.storage.hf import HuggingFaceStorageManager | |
| _storage_instance = None | |
| def get_storage() -> HuggingFaceStorageManager: | |
| """Return the configured singleton storage backend.""" | |
| global _storage_instance | |
| if config.STORAGE_MODE != config.HF_STORAGE_LABEL: | |
| raise RuntimeError( | |
| f"Unsupported STORAGE_MODE '{config.STORAGE_MODE}'. " | |
| "Local storage is disabled. Set STORAGE_MODE=HF." | |
| ) | |
| if _storage_instance is None: | |
| _storage_instance = HuggingFaceStorageManager() | |
| return _storage_instance | |