Spaces:
Running
Running
| from functools import lru_cache | |
| from typing import List | |
| from pydantic_settings import BaseSettings | |
| class Settings(BaseSettings): | |
| """Application settings optimized for HuggingFace Spaces.""" | |
| # Application metadata | |
| app_name: str = "API" | |
| app_version: str = "1.0.0" | |
| model_id: str = "LiquidAI/LFM2.5-1.2B-Instruct-ONNX" | |
| model_variant: str = "q8" | |
| # Server settings (HuggingFace Spaces uses port 7860) | |
| host: str = "0.0.0.0" | |
| port: int = 7860 | |
| # CORS settings | |
| cors_origins: List[str] = ["*"] | |
| temperature: float = 0.1 | |
| top_k: int = 50 | |
| top_p: float = 0.1 | |
| max_tokens: int = 2000 # Max output tokens (model supports 32K context) | |
| repetition_penalty: float = 1.05 | |
| num_threads: int = 2 | |
| # Logging | |
| log_level: str = "info" | |
| class Config: | |
| env_prefix = "LFM_" | |
| def get_settings() -> Settings: | |
| """Get cached settings.""" | |
| return Settings() | |
| settings = get_settings() | |