Spaces:
Runtime error
Runtime error
File size: 547 Bytes
68964c2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import os
from pathlib import Path
from app.core.logging_setup import logger
def setup_environment():
"""Set up environment variables and directories."""
try:
cache_dir = Path("/app/hf_cache")
cache_dir.mkdir(parents=True, exist_ok=True)
os.environ["HF_HOME"] = str(cache_dir)
os.environ["SENTENCE_TRANSFORMERS_HOME"] = str(cache_dir)
logger.info("Environment variables and cache directory set up successfully.")
except Exception as e:
logger.error(f"Error setting up environment: {e}") |