From d63130cd75c5f3408575060fa19c6327f0c59a6b Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Mon, 1 May 2023 23:39:54 -0500 Subject: [PATCH] feat(gui): add tile and stride params --- gui/src/client/api.ts | 13 ++--- gui/src/components/control/HighresControl.tsx | 12 ----- gui/src/components/control/ImageControl.tsx | 50 ++++++++++++++++++- gui/src/state.ts | 7 +-- 4 files changed, 60 insertions(+), 22 deletions(-) diff --git a/gui/src/client/api.ts b/gui/src/client/api.ts index da757bf2..a4c076fc 100644 --- a/gui/src/client/api.ts +++ b/gui/src/client/api.ts @@ -48,6 +48,10 @@ export interface BaseImgParams { negativePrompt?: string; batch: number; + tiledVAE: boolean; + tiles: number; + overlap: number; + cfg: number; steps: number; seed: number; @@ -160,8 +164,6 @@ export interface HighresParams { highresScale: number; highresSteps: number; highresStrength: number; - - tiledVAE: boolean; } /** @@ -404,6 +406,9 @@ export function makeImageURL(root: string, type: string, params: BaseImgParams): url.searchParams.append('cfg', params.cfg.toFixed(FIXED_FLOAT)); url.searchParams.append('eta', params.eta.toFixed(FIXED_FLOAT)); url.searchParams.append('steps', params.steps.toFixed(FIXED_INTEGER)); + url.searchParams.append('tiledVAE', String(params.tiledVAE)); + url.searchParams.append('tiles', params.tiles.toFixed(FIXED_INTEGER)); + url.searchParams.append('overlap', params.overlap.toFixed(FIXED_FLOAT)); if (doesExist(params.scheduler)) { url.searchParams.append('scheduler', params.scheduler); @@ -455,10 +460,6 @@ 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 1acaf4cb..3467a947 100644 --- a/gui/src/components/control/HighresControl.tsx +++ b/gui/src/components/control/HighresControl.tsx @@ -17,18 +17,6 @@ export function HighresControl() { const { t } = useTranslation(); return - { - setHighres({ - tiledVAE: highres.tiledVAE === false, - }); - }} - />} - /> + { + if (doesExist(props.onChange)) { + props.onChange({ + ...controlState, + tiledVAE: controlState.tiledVAE === false, + }); + } + }} + />} + /> + { + if (doesExist(props.onChange)) { + props.onChange({ + ...controlState, + tiles, + }); + } + }} + /> + { + if (doesExist(props.onChange)) { + props.onChange({ + ...controlState, + overlap, + }); + } + }} + /> + + ({ @@ -466,7 +468,6 @@ export function createStateSlices(server: ServerParams) { highresSteps: server.highresSteps.default, highresScale: server.highresScale.default, highresStrength: server.highresStrength.default, - tiledVAE: server.tiledVAE.default, }, }); }, @@ -537,7 +538,7 @@ export function createStateSlices(server: ServerParams) { const createResetSlice: Slice = (set) => ({ resetAll() { set((prev) => { - const next = {...prev}; + const next = { ...prev }; next.resetImg2Img(); next.resetInpaint(); next.resetTxt2Img();