Skip to content
GitHub

Configuration

Configuration options for lexigram-multimedia-upscale.


Configuration lives on UpscaleConfig (a lexigram.config.BaseConfig subclass). As a subsystem of the lexigram-multimedia umbrella, it is nested under the multimedia: key in application.yaml with environment-variable prefix LEX_MULTIMEDIA__UPSCALE__. Alternatively, pass an UpscaleConfig directly to UpscaleModule.configure(...).

Config classconfig_sectionProvider
UpscaleConfig"multimedia_upscale"consumed by UpscaleGenerationProvider (provider config_key = "multimedia_upscale")

Calling UpscaleModule.configure() with no arguments produces UpscaleConfig(backend="real-esrgan") — super-resolution against a reference server at http://localhost:5400.


multimedia:
upscale:
backend: "hat" # real-esrgan | hat
real_esrgan_base_url: "http://localhost:5400"
hat_base_url: "http://localhost:5401"
timeout: 30.0
from lexigram.multimedia.upscale import UpscaleModule
from lexigram.multimedia.upscale.config import UpscaleConfig
UpscaleModule.configure(
config=UpscaleConfig(backend="hat", hat_base_url="http://10.0.0.5:5401")
)

OptionTypeDefaultDescription
backendLiteral["real-esrgan", "hat"]"real-esrgan"Which super-resolution backend to build at registration time
real_esrgan_base_urlstr"http://localhost:5400"Base URL of the Real-ESRGAN reference server
hat_base_urlstr"http://localhost:5401"Base URL of the HAT reference server
timeoutfloat30.0Per-request HTTP timeout in seconds (aiohttp ClientTimeout.total)

The upscale factor is not config-state: pass it per request via UpscaleRequest.scale_factor (Literal[2, 4], default 4).

The provider forwards config into the backend constructors in UpscaleGenerationProvider.register():

backendClass constructedArgs
"real-esrgan"RealEsrganUpscaleProviderbase_url=real_esrgan_base_url, timeout, retry, circuit_breaker
"hat"HatUpscaleProviderbase_url=hat_base_url, timeout, retry, circuit_breaker
anything elseraises ProviderNotInstalledError

retry / circuit_breaker come from optional RetryPolicyProtocol / CircuitBreakerProtocol bindings in the container.


VariableDescription
LEX_MULTIMEDIA__UPSCALE__BACKENDOverride backend
LEX_MULTIMEDIA__UPSCALE__REAL_ESRGAN_BASE_URLOverride real_esrgan_base_url
LEX_MULTIMEDIA__UPSCALE__HAT_BASE_URLOverride hat_base_url
LEX_MULTIMEDIA__UPSCALE__TIMEOUTOverride timeout
Terminal window
export LEX_PROFILE=production
export LEX_MULTIMEDIA__UPSCALE__BACKEND=hat
export LEX_MULTIMEDIA__UPSCALE__HAT_BASE_URL=http://10.0.0.5:5401

module = UpscaleModule.stub()
# Equivalent to configure(config=UpscaleConfig(backend="real-esrgan"))
# — useful in test suites; the module is real, the default backend is pinned.
@module(imports=[UpscaleModule.configure()])
class AppModule(Module):
pass

The umbrella lexigram-multimedia orchestrator may also import this subsystem by entry point lexigram.multimedia.subsystems (upscale) or lexigram.multimedia.modules (upscale) — no config needed in that case beyond the multimedia: upscale: YAML section.

VideoUpscaleService only registers when a VideoProcessor is resolvable in the container (provided by lexigram-multimedia-video when ffmpeg is on PATH). No upscale-side flag controls this — presence of the processor is the switch.


  • ✅ Prefer environment variables / YAML for backend choice; keep secrets out of config entirely.
  • ✅ Use per-request scale_factor rather than forking config per scale.
  • ✅ Point *_base_url at machines that run lexigram-upscale-*-serve.
  • ❌ Don’t hardcode model weights or server code in the application — the reference servers are separate processes.
  • ❌ Don’t expect backend="real-esrgan" to work without a server listening on the configured port.