File size: 1,540 Bytes
4fc93b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94ddfa7
4fc93b8
 
 
 
 
 
 
 
7c5da40
 
c0426da
f4cb174
 
 
 
7c5da40
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
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
 
    # 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)
    
    AVAILABLE_MODELS = {
        "text": ["yaya36095/xlm-roberta-text-detector",
                 "almanach/xlmr-chatgptdetect-noisy",
                 "bibbbu/multilingual-ai-human-detector_xlm-roberta-base"],
        "image": ["capcheck/ai-image-detection",
                  "Hemg/Deepfake-image"],
    }

    MAX_CONTENT_SIZES = {
        "text": 5000,
        "image": 100 * 1024 * 1024,
    }


@lru_cache()
def get_settings() -> Settings:
    """Get cached application settings."""
    return Settings()