adsurkasur's picture
clone from arina-hf-spaces
68964c2
raw
history blame contribute delete
547 Bytes
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}")