Spaces:
Running
Running
File size: 1,456 Bytes
8aa3dc8 40f0cd4 8aa3dc8 | 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | from functools import lru_cache
from typing import List
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""Application settings optimized for CPU deployment."""
# Application metadata
app_name: str = "Vision"
app_version: str = "1.0.0"
# Model settings - Using official ONNX model with Q4 for speed
model_id: str = "LiquidAI/LFM2.5-VL-1.6B-ONNX"
encoder_variant: str = "q4"
decoder_variant: str = "q4"
# Server settings (same as lfm-text for consistency)
host: str = "0.0.0.0"
port: int = 7860
# CORS settings
cors_origins: List[str] = ["*"]
# Vision processing settings
min_image_tokens: int = 64
max_image_tokens: int = 256
do_image_splitting: bool = True
# Supported image formats
supported_formats: List[str] = ["jpeg", "jpg", "png", "gif", "webp", "bmp"]
max_image_size_mb: int = 10
# Generation defaults (from LiquidAI recommendations)
temperature: float = 0.1
top_k: int = 50
top_p: float = 0.5
min_p: float = 0.15
max_tokens: int = 2024
repetition_penalty: float = 1.05
# CPU optimization
num_threads: int = 2 # Optimized for 2 vCPU
# Logging
log_level: str = "info"
class Config:
env_prefix = "LFMVL_"
@lru_cache()
def get_settings() -> Settings:
"""Get cached settings."""
return Settings()
settings = get_settings()
|