Initial Real-ESRGAN API project setup

This commit is contained in:
Developer
2026-02-16 19:56:25 +01:00
commit 0e59652575
34 changed files with 3668 additions and 0 deletions

40
app/config.py Normal file
View File

@@ -0,0 +1,40 @@
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()