Spaces:
Sleeping
Sleeping
| """Configuration settings for the inference API.""" | |
| from functools import lru_cache | |
| from pydantic_settings import BaseSettings | |
| class Settings(BaseSettings): | |
| """Application settings loaded from environment variables.""" | |
| model_name: str = "distilbert-base-uncased-finetuned-sst-2-english" | |
| task: str = "text-classification" | |
| host: str = "0.0.0.0" | |
| port: int = 8000 | |
| max_batch_size: int = 32 | |
| device: str = "cpu" | |
| # HF Inference API settings | |
| use_api: bool = True # True = use HF API, False = load model locally | |
| api_token: str | None = None # HF API token (required if use_api=True) | |
| class Config: | |
| env_file = ".env" | |
| env_prefix = "HF_" | |
| def get_settings() -> Settings: | |
| """Get cached settings instance.""" | |
| return Settings() | |