Spaces:
Sleeping
Sleeping
File size: 1,492 Bytes
463afdd |
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 61 62 63 |
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
|