zelotech / config.py
matheusalencar's picture
first commit
1b64148
Raw History Blame Contribute Delete
1.2 kB
from functools import lru_cache
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
"""Configuracao por variaveis de ambiente (prefixo APP_) ou arquivo .env.
As duas decisoes que voce ainda nao tomou viram simples flags aqui:
- self-managed vs. gerenciado -> asr_backend / ocr_backend
- GPU vs. CPU -> device (+ asr_compute_type)
Nenhuma delas exige mexer no resto do codigo.
"""
model_config = SettingsConfigDict(env_file=".env", env_prefix="APP_", extra="ignore")
# --- inferencia de audio (ASR) ---
asr_backend: str = "local" # "local" hoje; amanha "azure" | "endpoint"
asr_model: str = "large-v3"
asr_compute_type: str = "int8" # "int8" p/ CPU, "float16" p/ GPU
# --- inferencia de texto (OCR) ---
ocr_backend: str = "local" # "local" hoje; amanha "azure" (Document Intelligence)...
ocr_lang: str = "por"
pdf_ocr_dpi: int = 300
pdf_min_chars_per_page: int = 20
# --- compute ---
device: str = "cpu" # "cpu" | "cuda"
@lru_cache
def get_settings() -> Settings:
return Settings()