Spaces:
Runtime error
Runtime error
Download edu_assistant/utils/redis_utils.py from codedog-ai/edu-assistant: direct link, hf CLI and curl.
- Browser
- Download file 542 Bytes
-
https://huggingface.co/spaces/codedog-ai/edu-assistant/resolve/main/edu_assistant/utils/redis_utils.py
- Command line
-
hf download hf://spaces/codedog-ai/edu-assistant/edu_assistant/utils/redis_utils.py
-
curl -L -o redis_utils.py https://huggingface.co/spaces/codedog-ai/edu-assistant/resolve/main/edu_assistant/utils/redis_utils.py
542 Bytes
| import os | |
| from functools import lru_cache | |
| from pydantic_redis import RedisConfig | |
| from redis import Redis | |
| host = os.environ.get("REDIS_HOST", "localhost") | |
| port = int(os.environ.get("REDIS_PORT", 6379)) | |
| password = os.environ.get("REDIS_PASSWORD", None) | |
| ssl = True if os.environ.get("REDIS_SSL") else False | |
| def get_redis_client(): | |
| return Redis(host=host, port=port, password=password, ssl=ssl) | |
| def get_redis_config(): | |
| return RedisConfig(host=host, port=port, password=password, ssl=ssl) | |