Spaces:
Sleeping
Sleeping
| from typing import Optional | |
| from pydantic_settings import BaseSettings, SettingsConfigDict | |
| class Settings(BaseSettings): | |
| model_config = SettingsConfigDict( | |
| # env_file is used for local dev (outside Docker). | |
| # Inside Docker, env vars are injected directly via docker-compose env_file/environment. | |
| env_file=".env", | |
| env_file_encoding="utf-8", | |
| case_sensitive=False, | |
| # If a var is passed as "" (empty string), treat it as unset and use the default. | |
| # This prevents a misconfigured docker-compose from silently clearing secret keys. | |
| env_ignore_empty=True, | |
| ) | |
| # Model | |
| model_path: str = "outputs/checkpoints/merged_model" | |
| device: Optional[str] = None # None → auto-detect (cuda if available, else cpu) | |
| # Gemini | |
| gemini_api_key: Optional[str] = None | |
| gemini_model: str = "gemini-2.5-flash" | |
| # Upload guard (enforced in Python before touching disk) | |
| max_upload_mb: int = 200 | |
| # Server | |
| host: str = "0.0.0.0" | |
| port: int = 8000 | |
| settings = Settings() | |