Spaces:
Sleeping
Sleeping
File size: 800 Bytes
b98ed7e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | """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_"
@lru_cache
def get_settings() -> Settings:
"""Get cached settings instance."""
return Settings()
|