| """Central settings. Everything tunable lives here, not in literals across the code.""" |
|
|
| from __future__ import annotations |
|
|
| from functools import lru_cache |
|
|
| from pydantic_settings import BaseSettings, SettingsConfigDict |
|
|
|
|
| class Settings(BaseSettings): |
| model_config = SettingsConfigDict(env_file=".env", extra="ignore") |
|
|
| |
| database_url: str = "sqlite:///./avis.db" |
| image_dir: str = "./data/images" |
|
|
| |
| detector_weights: str = "yolo11n.pt" |
| detector_conf: float = 0.05 |
| helmet_weights: str = "" |
| helmet_conf: float = 0.35 |
| helmet_match_iou: float = 0.4 |
|
|
| |
| seatbelt_check: bool = False |
|
|
| |
| plate_provider: str = "null" |
| plate_detector_model: str = "yolo-v9-t-384-license-plate-end2end" |
| plate_ocr_model: str = "global-plates-mobile-vit-v2-model" |
|
|
| |
| llm_provider: str = "null" |
| gemini_api_key: str = "" |
| gemini_model: str = "gemini-2.5-flash" |
|
|
| |
| auto_confirm_threshold: float = 0.85 |
| review_threshold: float = 0.55 |
|
|
| |
| quality_min_side: int = 64 |
| quality_blur_threshold: float = 8.0 |
| quality_dark_threshold: float = 15.0 |
| quality_bright_threshold: float = 245.0 |
|
|
| |
| w_detection: float = 0.3 |
| w_rule: float = 0.4 |
| w_attribute: float = 0.3 |
| w_vlm: float = 0.4 |
|
|
|
|
| @lru_cache |
| def get_settings() -> Settings: |
| return Settings() |
|
|