Spaces:
Sleeping
Sleeping
File size: 622 Bytes
2fe2727 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | """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
|