Bitcheck-image / app /config.py
BitCheck Codex
feat: add file validation and filename analysis
94db30d
Raw
History Blame Contribute Delete
1.28 kB
from __future__ import annotations
from pathlib import Path
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
service_name: str = "BitCheck Image Verification API"
max_upload_bytes: int = 12 * 1024 * 1024
allowed_extensions: set[str] = {"jpg", "jpeg", "png", "webp"}
model_path: Path = Path("models/bitcheck_efficientnet_b0_production.pth")
model_fallback_paths: list[Path] = [
Path("models/ai_vs_real_image_detector.pth"),
Path("models/best_ai_vs_real_efficientnet_b0.pth"),
]
model_arch: str = "efficientnet_b0"
model_input_size: int = 224
model_threshold: float = 0.5
uploads_dir: Path = Path("uploads")
outputs_dir: Path = Path("outputs")
reports_dir: Path = Path("outputs/reports")
watermark_templates_dir: Path = Path("templates/watermarks")
log_level: str = "INFO"
cors_origins: list[str] = ["*"]
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
settings = Settings()
settings.uploads_dir.mkdir(parents=True, exist_ok=True)
settings.outputs_dir.mkdir(parents=True, exist_ok=True)
settings.reports_dir.mkdir(parents=True, exist_ok=True)
settings.watermark_templates_dir.mkdir(parents=True, exist_ok=True)