41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
import json
|
|
from typing import List
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = {'env_prefix': 'RSR_'}
|
|
|
|
# Paths
|
|
upload_dir: str = '/data/uploads'
|
|
output_dir: str = '/data/outputs'
|
|
models_dir: str = '/data/models'
|
|
temp_dir: str = '/data/temp'
|
|
jobs_dir: str = '/data/jobs'
|
|
|
|
# Real-ESRGAN defaults
|
|
execution_providers: str = '["cpu"]'
|
|
execution_thread_count: int = 4
|
|
default_model: str = 'RealESRGAN_x4plus'
|
|
auto_model_download: bool = True
|
|
download_providers: str = '["huggingface"]'
|
|
tile_size: int = 400
|
|
tile_pad: int = 10
|
|
log_level: str = 'info'
|
|
|
|
# Limits
|
|
max_upload_size_mb: int = 500
|
|
max_image_dimension: int = 8192
|
|
sync_timeout_seconds: int = 300
|
|
auto_cleanup_hours: int = 24
|
|
|
|
def get_execution_providers(self) -> List[str]:
|
|
return json.loads(self.execution_providers)
|
|
|
|
def get_download_providers(self) -> List[str]:
|
|
return json.loads(self.download_providers)
|
|
|
|
|
|
settings = Settings()
|