Spaces:
Configuration error
Configuration error
Download inference/core/cache/__init__.py from Fucius/OMG-InstantID: direct link, hf CLI and curl.
- Browser
- Download file 813 Bytes
-
https://huggingface.co/spaces/Fucius/OMG-InstantID/resolve/main/inference/core/cache/__init__.py
- Command line
-
hf download hf://spaces/Fucius/OMG-InstantID/inference/core/cache/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/Fucius/OMG-InstantID/resolve/main/inference/core/cache/__init__.py
813 Bytes
| from redis.exceptions import ConnectionError, TimeoutError | |
| from inference.core import logger | |
| from inference.core.cache.memory import MemoryCache | |
| from inference.core.cache.redis import RedisCache | |
| from inference.core.env import REDIS_HOST, REDIS_PORT, REDIS_SSL, REDIS_TIMEOUT | |
| if REDIS_HOST is not None: | |
| try: | |
| cache = RedisCache( | |
| host=REDIS_HOST, port=REDIS_PORT, ssl=REDIS_SSL, timeout=REDIS_TIMEOUT | |
| ) | |
| logger.info(f"Redis Cache initialised") | |
| except (TimeoutError, ConnectionError): | |
| logger.error( | |
| f"Could not connect to Redis under {REDIS_HOST}:{REDIS_PORT}. MemoryCache to be used." | |
| ) | |
| cache = MemoryCache() | |
| logger.info(f"Memory Cache initialised") | |
| else: | |
| cache = MemoryCache() | |
| logger.info(f"Memory Cache initialised") | |