Spaces:
Runtime error
Runtime error
File size: 1,329 Bytes
4fc93b8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | import os
from typing import Optional
from functools import lru_cache
class Settings:
"""Application settings with environment variable support."""
# Application
APP_NAME: str = "Deepfake Detection Service"
APP_VERSION: str = "1.0.0"
DEBUG: bool = os.getenv("DEBUG", "True").lower() == "true"
# Server
HOST: str = os.getenv("HOST", "127.0.0.1")
PORT: int = int(os.getenv("PORT", "8000"))
# File handling
DOWNLOAD_TIMEOUT: int = int(os.getenv("DOWNLOAD_TIMEOUT", "30"))
MAX_FILE_SIZE: int = int(os.getenv("MAX_FILE_SIZE", str(100 * 1024 * 1024))) # 100 MB
# ML Model configuration
DEFAULT_DETECTOR_MODEL: str = os.getenv("DEFAULT_DETECTOR_MODEL", "mock")
# Supported models: "mock", "deepseek", "openai", etc. (easy to add more)
# Redis configuration (for future queuing)
REDIS_ENABLED: bool = os.getenv("REDIS_ENABLED", "False").lower() == "true"
REDIS_URL: str = os.getenv("REDIS_URL", "redis://localhost:6379")
REDIS_QUEUE_NAME: str = os.getenv("REDIS_QUEUE_NAME", "deepfake_analysis")
# Logging
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
LOG_FILE: Optional[str] = os.getenv("LOG_FILE", None)
@lru_cache()
def get_settings() -> Settings:
"""Get cached application settings."""
return Settings()
|