diff --git a/api/onnx_web/params.py b/api/onnx_web/params.py index 9856e3a0..14f4cc0c 100644 --- a/api/onnx_web/params.py +++ b/api/onnx_web/params.py @@ -398,12 +398,14 @@ class HighresParams: strength: float, method: Literal["bilinear", "lanczos", "upscale"] = "lanczos", iterations: int = 1, + tiled_vae: bool = False, ): self.scale = scale self.steps = steps self.strength = strength self.method = method self.iterations = iterations + self.tiled_vae = tiled_vae def resize(self, size: Size) -> Size: return Size( @@ -418,4 +420,5 @@ class HighresParams: "scale": self.scale, "steps": self.steps, "strength": self.strength, + "tiled_vae": self.tiled_vae, } diff --git a/api/onnx_web/server/params.py b/api/onnx_web/server/params.py index ef1123f4..17a94e64 100644 --- a/api/onnx_web/server/params.py +++ b/api/onnx_web/server/params.py @@ -13,7 +13,7 @@ from ..params import ( Size, UpscaleParams, ) -from ..utils import get_and_clamp_float, get_and_clamp_int, get_from_list, get_not_empty +from ..utils import get_and_clamp_float, get_and_clamp_int, get_boolean, get_from_list, get_not_empty from .context import ServerContext from .load import ( get_available_platforms, @@ -277,10 +277,13 @@ def highres_from_request() -> HighresParams: get_config_value("highresStrength", "min"), ) + tiled_vae = get_boolean(request.args, "tiledVAE", get_config_value("tiledVAE")) + return HighresParams( scale, steps, strength, method=method, iterations=iterations, + tiled_vae=tiled_vae, ) diff --git a/api/params.json b/api/params.json index 6b591819..1a0602b3 100644 --- a/api/params.json +++ b/api/params.json @@ -180,6 +180,9 @@ "max": 1, "step": 0.01 }, + "tiledVAE": { + "default": false + }, "tileOrder": { "default": "spiral", "keys": [ diff --git a/gui/Makefile b/gui/Makefile index 8f86f0b0..d99eda0b 100644 --- a/gui/Makefile +++ b/gui/Makefile @@ -30,7 +30,7 @@ build-shebang: build bundle: build node esbuild.js cp -v src/index.html out/ - cp -v examples/config.json out/ + cp -v src/config.json out/ COVER_OPTS := --all \ --exclude ".eslintrc.js" \ diff --git a/gui/esbuild.js b/gui/esbuild.js index af312ccd..fee52624 100644 --- a/gui/esbuild.js +++ b/gui/esbuild.js @@ -54,7 +54,7 @@ if (watch) { ], plugins: [ ...plugins, - ...copyArray(['src/index.html', 'examples/config.json']), + ...copyArray(['src/index.html', 'src/config.json']), ], banner: { js: `new EventSource('/esbuild').addEventListener('change', () => location.reload());`, diff --git a/gui/src/client/api.ts b/gui/src/client/api.ts index 03cb37f7..da757bf2 100644 --- a/gui/src/client/api.ts +++ b/gui/src/client/api.ts @@ -160,6 +160,8 @@ export interface HighresParams { highresScale: number; highresSteps: number; highresStrength: number; + + tiledVAE: boolean; } /** @@ -453,6 +455,10 @@ export function appendUpscaleToURL(url: URL, upscale: UpscaleParams) { } export function appendHighresToURL(url: URL, highres: HighresParams) { + if (highres.tiledVAE) { + url.searchParams.append('tiledVAE', String(highres.tiledVAE)); + } + if (highres.enabled) { url.searchParams.append('highresIterations', highres.highresIterations.toFixed(FIXED_INTEGER)); url.searchParams.append('highresMethod', highres.highresMethod); diff --git a/gui/src/components/control/HighresControl.tsx b/gui/src/components/control/HighresControl.tsx index 2110e7a4..1acaf4cb 100644 --- a/gui/src/components/control/HighresControl.tsx +++ b/gui/src/components/control/HighresControl.tsx @@ -17,6 +17,18 @@ export function HighresControl() { const { t } = useTranslation(); return + { + setHighres({ + tiledVAE: highres.tiledVAE === false, + }); + }} + />} + /> {t('parameter.highres.method')}