SentinelReview-AI / src /config.py
amadmateen's picture
Refactor: Production-grade modular layout, NLTK permissions fix, and editorial audit dashboard overhaul
405a3f0
Raw History Blame Contribute Delete
684 Bytes
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")