import os import torch # Base directory resolution BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Resource directory paths DATA_DIR = os.path.join(BASE_DIR, "data") MODEL_DIR = os.path.join(BASE_DIR, "models") MODEL_PATH = os.path.join(MODEL_DIR, "DistilBert_resnet.pth") # Server settings MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB max upload size # Hugging Face token resolution HF_TOKEN = os.environ.get("HF_TOKEN") # Dynamic hardware device mapping (CUDA -> MPS -> CPU) if torch.cuda.is_available(): DEVICE = torch.device("cuda") elif torch.backends.mps.is_available(): DEVICE = torch.device("mps") else: DEVICE = torch.device("cpu")