Spaces:
Sleeping
Sleeping
| from pydantic_settings import BaseSettings | |
| from typing import List | |
| import os | |
| class Settings(BaseSettings): | |
| """Application settings loaded from environment variables""" | |
| # Server Configuration | |
| HOST: str = "0.0.0.0" | |
| PORT: int = 8000 | |
| DEBUG: bool = True | |
| WORKERS: int = 4 | |
| # Model Configuration | |
| DEPTH_MODEL_SMALL: str = "depth_anything_v2_vits.onnx" | |
| DEPTH_MODEL_LARGE: str = "depth_anything_v2_vitl.onnx" | |
| MODEL_CACHE_DIR: str = "./models/cache" | |
| # Redis Configuration | |
| REDIS_HOST: str = "localhost" | |
| REDIS_PORT: int = 6379 | |
| REDIS_DB: int = 0 | |
| REDIS_PASSWORD: str = "" | |
| # Cache Settings | |
| ENABLE_CACHE: bool = True | |
| CACHE_TTL: int = 3600 | |
| # Processing Configuration | |
| MAX_IMAGE_SIZE: int = 4096 | |
| DEFAULT_IMAGE_SIZE: int = 1024 | |
| PREVIEW_SIZE: int = 384 | |
| # GPU Configuration | |
| CUDA_VISIBLE_DEVICES: str = "0" | |
| USE_GPU: bool = True | |
| TRT_OPTIMIZATION: bool = True | |
| # Storage (optional) | |
| S3_BUCKET: str = "" | |
| S3_REGION: str = "us-east-1" | |
| AWS_ACCESS_KEY_ID: str = "" | |
| AWS_SECRET_ACCESS_KEY: str = "" | |
| # API Settings | |
| CORS_ORIGINS: List[str] = ["http://localhost:3000", "http://localhost:5173"] | |
| MAX_UPLOAD_SIZE: int = 10485760 # 10MB | |
| RATE_LIMIT_PER_MINUTE: int = 60 | |
| class Config: | |
| env_file = ".env" | |
| case_sensitive = True | |
| # Global settings instance | |
| settings = Settings() | |
| def get_settings() -> Settings: | |
| """Get application settings""" | |
| return settings | |