from pathlib import Path
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""Application configuration loaded from environment variables."""
host: str = "0.0.0.0"
port: int = 8765
log_level: str = "INFO"
# TTS model configuration
tts_backend: str = "f5_tts" # or "dummy" for tests
tts_model_path: Path | None = None
tts_vocab_path: Path | None = None
tts_sample_rate: int = 24_000
# Reference voices directory
voices_dir: Path = Path("voices")
default_voice_ref: Path | None = None # env: DEFAULT_VOICE_REF
# Segmentation thresholds
min_segment_length: int = 30
max_segment_length: int = 200
max_buffer_wait_ms: int = 500
# GPU / inference
device: str = "cuda" # or "cpu"
dtype: str = "bfloat16"
# Warm-up
warmup: bool = False # run a dummy inference at startup
warmup_text: str = "Hello world."
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
settings = Settings()