From 5e5d748c0b8f69eae27ce77e58b7f31d64918c4a Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Mon, 16 Jan 2023 14:17:28 -0600 Subject: [PATCH] fix(gui): send upscale params --- gui/src/client.ts | 8 ++++---- gui/src/components/Img2Img.tsx | 4 +++- gui/src/components/Inpaint.tsx | 8 +++++--- gui/src/components/Txt2Img.tsx | 3 ++- gui/src/components/UpscaleControl.tsx | 1 + 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gui/src/client.ts b/gui/src/client.ts index e311a00e..6e3d28a5 100644 --- a/gui/src/client.ts +++ b/gui/src/client.ts @@ -97,10 +97,10 @@ export interface ApiClient { platforms(): Promise>; schedulers(): Promise>; - img2img(params: Img2ImgParams): Promise; - txt2img(params: Txt2ImgParams): Promise; - inpaint(params: InpaintParams): Promise; - outpaint(params: OutpaintParams): Promise; + img2img(params: Img2ImgParams, upscale?: UpscaleParams): Promise; + txt2img(params: Txt2ImgParams, upscale?: UpscaleParams): Promise; + inpaint(params: InpaintParams, upscale?: UpscaleParams): Promise; + outpaint(params: OutpaintParams, upscale?: UpscaleParams): Promise; ready(params: ApiResponse): Promise; } diff --git a/gui/src/components/Img2Img.tsx b/gui/src/components/Img2Img.tsx index ff0d872e..7105373f 100644 --- a/gui/src/components/Img2Img.tsx +++ b/gui/src/components/Img2Img.tsx @@ -24,12 +24,14 @@ export function Img2Img(props: Img2ImgProps) { const { config, model, platform } = props; async function uploadSource() { + const upscale = state.getState().upscale; + const output = await client.img2img({ ...params, model, platform, source: mustExist(params.source), // TODO: show an error if this doesn't exist - }); + }, upscale); setLoading(output); } diff --git a/gui/src/components/Inpaint.tsx b/gui/src/components/Inpaint.tsx index 5f67b900..4fa7872f 100644 --- a/gui/src/components/Inpaint.tsx +++ b/gui/src/components/Inpaint.tsx @@ -34,7 +34,9 @@ export function Inpaint(props: InpaintProps) { }); async function uploadSource(): Promise { - const outpaint = state.getState().outpaint; // TODO: seems shady + // these are not watched by the component, only sent by the mutation + const outpaint = state.getState().outpaint; + const upscale = state.getState().upscale; if (outpaint.enabled) { const output = await client.outpaint({ @@ -44,7 +46,7 @@ export function Inpaint(props: InpaintProps) { platform, mask: mustExist(params.mask), source: mustExist(params.source), - }); + }, upscale); setLoading(output); } else { @@ -54,7 +56,7 @@ export function Inpaint(props: InpaintProps) { platform, mask: mustExist(params.mask), source: mustExist(params.source), - }); + }, upscale); setLoading(output); } diff --git a/gui/src/components/Txt2Img.tsx b/gui/src/components/Txt2Img.tsx index 313b4517..2bb32b59 100644 --- a/gui/src/components/Txt2Img.tsx +++ b/gui/src/components/Txt2Img.tsx @@ -23,11 +23,12 @@ export function Txt2Img(props: Txt2ImgProps) { const { config, model, platform } = props; async function generateImage() { + const upscale = state.getState().upscale; const output = await client.txt2img({ ...params, model, platform, - }); + }, upscale); setLoading(output); } diff --git a/gui/src/components/UpscaleControl.tsx b/gui/src/components/UpscaleControl.tsx index 813286ea..a523541e 100644 --- a/gui/src/components/UpscaleControl.tsx +++ b/gui/src/components/UpscaleControl.tsx @@ -50,6 +50,7 @@ export function UpscaleControl(props: UpscaleControlProps) { />