diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasGraph.ts index dd0a5e6619..d268a3990d 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasGraph.ts @@ -3,8 +3,10 @@ import { NonNullableGraph } from 'features/nodes/types/types'; import { ImageDTO } from 'services/api/types'; import { buildCanvasImageToImageGraph } from './buildCanvasImageToImageGraph'; import { buildCanvasInpaintGraph } from './buildCanvasInpaintGraph'; +import { buildCanvasOutpaintGraph } from './buildCanvasOutpaintGraph'; import { buildCanvasSDXLImageToImageGraph } from './buildCanvasSDXLImageToImageGraph'; import { buildCanvasSDXLInpaintGraph } from './buildCanvasSDXLInpaintGraph'; +import { buildCanvasSDXLOutpaintGraph } from './buildCanvasSDXLOutpaintGraph'; import { buildCanvasSDXLTextToImageGraph } from './buildCanvasSDXLTextToImageGraph'; import { buildCanvasTextToImageGraph } from './buildCanvasTextToImageGraph'; @@ -37,11 +39,10 @@ export const buildCanvasGraph = ( } else { graph = buildCanvasImageToImageGraph(state, canvasInitImage); } - } else { + } else if (generationMode === 'inpaint') { if (!canvasInitImage || !canvasMaskImage) { throw new Error('Missing canvas init and mask images'); } - if ( state.generation.model && state.generation.model.base_model === 'sdxl' @@ -54,6 +55,22 @@ export const buildCanvasGraph = ( } else { graph = buildCanvasInpaintGraph(state, canvasInitImage, canvasMaskImage); } + } else { + if (!canvasInitImage) { + throw new Error('Missing canvas init image'); + } + if ( + state.generation.model && + state.generation.model.base_model === 'sdxl' + ) { + graph = buildCanvasSDXLOutpaintGraph( + state, + canvasInitImage, + canvasMaskImage + ); + } else { + graph = buildCanvasOutpaintGraph(state, canvasInitImage, canvasMaskImage); + } } return graph; diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts index 1e2b9d76d8..5afcd80d85 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts @@ -3,8 +3,6 @@ import { RootState } from 'app/store/store'; import { NonNullableGraph } from 'features/nodes/types/types'; import { ImageDTO, - InfillPatchmatchInvocation, - InfillTileInvocation, RandomIntInvocation, RangeOfSizeInvocation, } from 'services/api/types'; @@ -20,13 +18,10 @@ import { INPAINT_FINAL_IMAGE, INPAINT_GRAPH, INPAINT_IMAGE, - INPAINT_INFILL, ITERATE, LATENTS_TO_IMAGE, MAIN_MODEL_LOADER, MASK_BLUR, - MASK_COMBINE, - MASK_FROM_ALPHA, NEGATIVE_CONDITIONING, NOISE, POSITIVE_CONDITIONING, @@ -60,8 +55,6 @@ export const buildCanvasInpaintGraph = ( shouldUseCpuNoise, maskBlur, maskBlurMethod, - tileSize, - infillMethod, clipSkip, } = state.generation; @@ -84,23 +77,6 @@ export const buildCanvasInpaintGraph = ( ? shouldUseCpuNoise : shouldUseCpuNoise; - let infillNode: InfillTileInvocation | InfillPatchmatchInvocation = { - type: 'infill_tile', - id: INPAINT_INFILL, - is_intermediate: true, - image: canvasInitImage, - tile_size: tileSize, - }; - - if (infillMethod === 'patchmatch') { - infillNode = { - type: 'infill_patchmatch', - id: INPAINT_INFILL, - is_intermediate: true, - image: canvasInitImage, - }; - } - const graph: NonNullableGraph = { id: INPAINT_GRAPH, nodes: { @@ -114,31 +90,20 @@ export const buildCanvasInpaintGraph = ( denoising_start: 1 - strength, denoising_end: 1, }, - [infillNode.id]: infillNode, - [MASK_FROM_ALPHA]: { - type: 'tomask', - id: MASK_FROM_ALPHA, - is_intermediate: true, - image: canvasInitImage, - }, - [MASK_COMBINE]: { - type: 'mask_combine', - id: MASK_COMBINE, - is_intermediate: true, - mask2: canvasMaskImage, - }, [MASK_BLUR]: { - type: 'img_blur', + type: 'mask_blur', id: MASK_BLUR, is_intermediate: true, radius: maskBlur, blur_type: maskBlurMethod, + mask: canvasMaskImage, }, [INPAINT_IMAGE]: { type: 'i2l', id: INPAINT_IMAGE, is_intermediate: true, fp32: vaePrecision === 'fp32' ? true : false, + image: canvasInitImage, }, [NOISE]: { type: 'noise', @@ -182,11 +147,14 @@ export const buildCanvasInpaintGraph = ( type: 'color_correct', id: COLOR_CORRECT, is_intermediate: true, + reference: canvasInitImage, + mask: canvasMaskImage, }, [INPAINT_FINAL_IMAGE]: { type: 'img_paste', id: INPAINT_FINAL_IMAGE, is_intermediate: true, + base_image: canvasInitImage, }, [RANGE_OF_SIZE]: { type: 'range_of_size', @@ -274,16 +242,6 @@ export const buildCanvasInpaintGraph = ( field: 'noise', }, }, - { - source: { - node_id: INPAINT_INFILL, - field: 'image', - }, - destination: { - node_id: INPAINT_IMAGE, - field: 'image', - }, - }, { source: { node_id: INPAINT_IMAGE, @@ -296,29 +254,9 @@ export const buildCanvasInpaintGraph = ( }, { source: { - node_id: MASK_FROM_ALPHA, + node_id: MASK_BLUR, field: 'mask', }, - destination: { - node_id: MASK_COMBINE, - field: 'mask1', - }, - }, - { - source: { - node_id: MASK_COMBINE, - field: 'image', - }, - destination: { - node_id: MASK_BLUR, - field: 'image', - }, - }, - { - source: { - node_id: MASK_BLUR, - field: 'image', - }, destination: { node_id: INPAINT, field: 'mask', @@ -354,26 +292,6 @@ export const buildCanvasInpaintGraph = ( field: 'latents', }, }, - { - source: { - node_id: INPAINT_INFILL, - field: 'image', - }, - destination: { - node_id: COLOR_CORRECT, - field: 'reference', - }, - }, - { - source: { - node_id: MASK_BLUR, - field: 'image', - }, - destination: { - node_id: COLOR_CORRECT, - field: 'mask', - }, - }, { source: { node_id: LATENTS_TO_IMAGE, @@ -384,20 +302,10 @@ export const buildCanvasInpaintGraph = ( field: 'image', }, }, - { - source: { - node_id: INPAINT_INFILL, - field: 'image', - }, - destination: { - node_id: INPAINT_FINAL_IMAGE, - field: 'base_image', - }, - }, { source: { node_id: MASK_BLUR, - field: 'image', + field: 'mask', }, destination: { node_id: INPAINT_FINAL_IMAGE, diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasOutpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasOutpaintGraph.ts new file mode 100644 index 0000000000..a11473314d --- /dev/null +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasOutpaintGraph.ts @@ -0,0 +1,461 @@ +import { logger } from 'app/logging/logger'; +import { RootState } from 'app/store/store'; +import { NonNullableGraph } from 'features/nodes/types/types'; +import { + ImageDTO, + InfillPatchmatchInvocation, + InfillTileInvocation, + RandomIntInvocation, + RangeOfSizeInvocation, +} from 'services/api/types'; +import { addControlNetToLinearGraph } from './addControlNetToLinearGraph'; +import { addLoRAsToGraph } from './addLoRAsToGraph'; +import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph'; +import { addVAEToGraph } from './addVAEToGraph'; +import { addWatermarkerToGraph } from './addWatermarkerToGraph'; +import { + CLIP_SKIP, + COLOR_CORRECT, + INPAINT, + INPAINT_FINAL_IMAGE, + INPAINT_GRAPH, + INPAINT_IMAGE, + INPAINT_INFILL, + ITERATE, + LATENTS_TO_IMAGE, + MAIN_MODEL_LOADER, + MASK_BLUR, + MASK_COMBINE, + MASK_FROM_ALPHA, + NEGATIVE_CONDITIONING, + NOISE, + POSITIVE_CONDITIONING, + RANDOM_INT, + RANGE_OF_SIZE, +} from './constants'; + +/** + * Builds the Canvas tab's Outpaint graph. + */ +export const buildCanvasOutpaintGraph = ( + state: RootState, + canvasInitImage: ImageDTO, + canvasMaskImage?: ImageDTO +): NonNullableGraph => { + const log = logger('nodes'); + const { + positivePrompt, + negativePrompt, + model, + cfgScale: cfg_scale, + scheduler, + steps, + img2imgStrength: strength, + shouldFitToWidthHeight, + iterations, + seed, + shouldRandomizeSeed, + vaePrecision, + shouldUseNoiseSettings, + shouldUseCpuNoise, + maskBlur, + maskBlurMethod, + tileSize, + infillMethod, + clipSkip, + } = state.generation; + + if (!model) { + log.error('No model found in state'); + throw new Error('No model found in state'); + } + + // The bounding box determines width and height, not the width and height params + const { width, height } = state.canvas.boundingBoxDimensions; + + // We may need to set the inpaint width and height to scale the image + const { + scaledBoundingBoxDimensions, + boundingBoxScaleMethod, + shouldAutoSave, + } = state.canvas; + + const use_cpu = shouldUseNoiseSettings + ? shouldUseCpuNoise + : shouldUseCpuNoise; + + let infillNode: InfillTileInvocation | InfillPatchmatchInvocation = { + type: 'infill_tile', + id: INPAINT_INFILL, + is_intermediate: true, + image: canvasInitImage, + tile_size: tileSize, + }; + + if (infillMethod === 'patchmatch') { + infillNode = { + type: 'infill_patchmatch', + id: INPAINT_INFILL, + is_intermediate: true, + image: canvasInitImage, + }; + } + + const graph: NonNullableGraph = { + id: INPAINT_GRAPH, + nodes: { + [INPAINT]: { + type: 'denoise_latents', + id: INPAINT, + is_intermediate: true, + steps: steps, + cfg_scale: cfg_scale, + scheduler: scheduler, + denoising_start: 1 - strength, + denoising_end: 1, + }, + [infillNode.id]: infillNode, + [MASK_FROM_ALPHA]: { + type: 'tomask', + id: MASK_FROM_ALPHA, + is_intermediate: true, + image: canvasInitImage, + }, + [MASK_COMBINE]: { + type: 'mask_combine', + id: MASK_COMBINE, + is_intermediate: true, + mask2: canvasMaskImage, + }, + [MASK_BLUR]: { + type: 'mask_blur', + id: MASK_BLUR, + is_intermediate: true, + radius: maskBlur, + blur_type: maskBlurMethod, + }, + [INPAINT_IMAGE]: { + type: 'i2l', + id: INPAINT_IMAGE, + is_intermediate: true, + fp32: vaePrecision === 'fp32' ? true : false, + }, + [NOISE]: { + type: 'noise', + id: NOISE, + width, + height, + use_cpu, + is_intermediate: true, + }, + [POSITIVE_CONDITIONING]: { + type: 'compel', + id: POSITIVE_CONDITIONING, + is_intermediate: true, + prompt: positivePrompt, + }, + [NEGATIVE_CONDITIONING]: { + type: 'compel', + id: NEGATIVE_CONDITIONING, + is_intermediate: true, + prompt: negativePrompt, + }, + [MAIN_MODEL_LOADER]: { + type: 'main_model_loader', + id: MAIN_MODEL_LOADER, + is_intermediate: true, + model, + }, + [LATENTS_TO_IMAGE]: { + type: 'l2i', + id: LATENTS_TO_IMAGE, + is_intermediate: true, + fp32: vaePrecision === 'fp32' ? true : false, + }, + [CLIP_SKIP]: { + type: 'clip_skip', + id: CLIP_SKIP, + is_intermediate: true, + skipped_layers: clipSkip, + }, + [COLOR_CORRECT]: { + type: 'color_correct', + id: COLOR_CORRECT, + is_intermediate: true, + }, + [INPAINT_FINAL_IMAGE]: { + type: 'img_paste', + id: INPAINT_FINAL_IMAGE, + is_intermediate: true, + }, + [RANGE_OF_SIZE]: { + type: 'range_of_size', + id: RANGE_OF_SIZE, + is_intermediate: true, + // seed - must be connected manually + // start: 0, + size: iterations, + step: 1, + }, + [ITERATE]: { + type: 'iterate', + id: ITERATE, + is_intermediate: true, + }, + }, + edges: [ + { + source: { + node_id: MAIN_MODEL_LOADER, + field: 'unet', + }, + destination: { + node_id: INPAINT, + field: 'unet', + }, + }, + { + source: { + node_id: MAIN_MODEL_LOADER, + field: 'clip', + }, + destination: { + node_id: CLIP_SKIP, + field: 'clip', + }, + }, + { + source: { + node_id: CLIP_SKIP, + field: 'clip', + }, + destination: { + node_id: POSITIVE_CONDITIONING, + field: 'clip', + }, + }, + { + source: { + node_id: CLIP_SKIP, + field: 'clip', + }, + destination: { + node_id: NEGATIVE_CONDITIONING, + field: 'clip', + }, + }, + { + source: { + node_id: NEGATIVE_CONDITIONING, + field: 'conditioning', + }, + destination: { + node_id: INPAINT, + field: 'negative_conditioning', + }, + }, + { + source: { + node_id: POSITIVE_CONDITIONING, + field: 'conditioning', + }, + destination: { + node_id: INPAINT, + field: 'positive_conditioning', + }, + }, + { + source: { + node_id: NOISE, + field: 'noise', + }, + destination: { + node_id: INPAINT, + field: 'noise', + }, + }, + { + source: { + node_id: INPAINT_INFILL, + field: 'image', + }, + destination: { + node_id: INPAINT_IMAGE, + field: 'image', + }, + }, + { + source: { + node_id: INPAINT_IMAGE, + field: 'latents', + }, + destination: { + node_id: INPAINT, + field: 'latents', + }, + }, + { + source: { + node_id: MASK_FROM_ALPHA, + field: 'mask', + }, + destination: { + node_id: MASK_COMBINE, + field: 'mask1', + }, + }, + { + source: { + node_id: MASK_COMBINE, + field: 'mask', + }, + destination: { + node_id: MASK_BLUR, + field: 'mask', + }, + }, + { + source: { + node_id: MASK_BLUR, + field: 'mask', + }, + destination: { + node_id: INPAINT, + field: 'mask', + }, + }, + { + source: { + node_id: RANGE_OF_SIZE, + field: 'collection', + }, + destination: { + node_id: ITERATE, + field: 'collection', + }, + }, + { + source: { + node_id: ITERATE, + field: 'item', + }, + destination: { + node_id: NOISE, + field: 'seed', + }, + }, + { + source: { + node_id: INPAINT, + field: 'latents', + }, + destination: { + node_id: LATENTS_TO_IMAGE, + field: 'latents', + }, + }, + { + source: { + node_id: INPAINT_INFILL, + field: 'image', + }, + destination: { + node_id: COLOR_CORRECT, + field: 'reference', + }, + }, + { + source: { + node_id: MASK_BLUR, + field: 'mask', + }, + destination: { + node_id: COLOR_CORRECT, + field: 'mask', + }, + }, + { + source: { + node_id: LATENTS_TO_IMAGE, + field: 'image', + }, + destination: { + node_id: COLOR_CORRECT, + field: 'image', + }, + }, + { + source: { + node_id: INPAINT_INFILL, + field: 'image', + }, + destination: { + node_id: INPAINT_FINAL_IMAGE, + field: 'base_image', + }, + }, + { + source: { + node_id: MASK_BLUR, + field: 'mask', + }, + destination: { + node_id: INPAINT_FINAL_IMAGE, + field: 'mask', + }, + }, + { + source: { + node_id: COLOR_CORRECT, + field: 'image', + }, + destination: { + node_id: INPAINT_FINAL_IMAGE, + field: 'image', + }, + }, + ], + }; + + // Add VAE + addVAEToGraph(state, graph, MAIN_MODEL_LOADER); + + // handle seed + if (shouldRandomizeSeed) { + // Random int node to generate the starting seed + const randomIntNode: RandomIntInvocation = { + id: RANDOM_INT, + type: 'rand_int', + }; + + graph.nodes[RANDOM_INT] = randomIntNode; + + // Connect random int to the start of the range of size so the range starts on the random first seed + graph.edges.push({ + source: { node_id: RANDOM_INT, field: 'a' }, + destination: { node_id: RANGE_OF_SIZE, field: 'start' }, + }); + } else { + // User specified seed, so set the start of the range of size to the seed + (graph.nodes[RANGE_OF_SIZE] as RangeOfSizeInvocation).start = seed; + } + + // add LoRA support + addLoRAsToGraph(state, graph, INPAINT, MAIN_MODEL_LOADER); + + // add controlnet, mutating `graph` + addControlNetToLinearGraph(state, graph, INPAINT); + + // NSFW & watermark - must be last thing added to graph + if (state.system.shouldUseNSFWChecker) { + // must add before watermarker! + addNSFWCheckerToGraph(state, graph, INPAINT); + } + + if (state.system.shouldUseWatermarker) { + // must add after nsfw checker! + addWatermarkerToGraph(state, graph, INPAINT); + } + + return graph; +}; diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts index 04cc120cbe..1d05d05073 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts @@ -3,8 +3,6 @@ import { RootState } from 'app/store/store'; import { NonNullableGraph } from 'features/nodes/types/types'; import { ImageDTO, - InfillPatchmatchInvocation, - InfillTileInvocation, RandomIntInvocation, RangeOfSizeInvocation, } from 'services/api/types'; @@ -20,12 +18,9 @@ import { INPAINT_FINAL_IMAGE, INPAINT_GRAPH, INPAINT_IMAGE, - INPAINT_INFILL, ITERATE, LATENTS_TO_IMAGE, MASK_BLUR, - MASK_COMBINE, - MASK_FROM_ALPHA, NEGATIVE_CONDITIONING, NOISE, POSITIVE_CONDITIONING, @@ -60,8 +55,6 @@ export const buildCanvasSDXLInpaintGraph = ( shouldUseCpuNoise, maskBlur, maskBlurMethod, - tileSize, - infillMethod, } = state.generation; const { @@ -91,69 +84,13 @@ export const buildCanvasSDXLInpaintGraph = ( ? shouldUseCpuNoise : shouldUseCpuNoise; - let infillNode: InfillTileInvocation | InfillPatchmatchInvocation = { - type: 'infill_tile', - id: INPAINT_INFILL, - is_intermediate: true, - image: canvasInitImage, - tile_size: tileSize, - }; - - if (infillMethod === 'patchmatch') { - infillNode = { - type: 'infill_patchmatch', - id: INPAINT_INFILL, - is_intermediate: true, - image: canvasInitImage, - }; - } - const graph: NonNullableGraph = { id: INPAINT_GRAPH, nodes: { - [INPAINT]: { - type: 'denoise_latents', - id: INPAINT, - is_intermediate: true, - steps: steps, - cfg_scale: cfg_scale, - scheduler: scheduler, - denoising_start: 1 - strength, - denoising_end: shouldUseSDXLRefiner ? refinerStart : 1, - }, - [infillNode.id]: infillNode, - [MASK_FROM_ALPHA]: { - type: 'tomask', - id: MASK_FROM_ALPHA, - is_intermediate: true, - image: canvasInitImage, - }, - [MASK_COMBINE]: { - type: 'mask_combine', - id: MASK_COMBINE, - is_intermediate: true, - mask2: canvasMaskImage, - }, - [MASK_BLUR]: { - type: 'img_blur', - id: MASK_BLUR, - is_intermediate: true, - radius: maskBlur, - blur_type: maskBlurMethod, - }, - [INPAINT_IMAGE]: { - type: 'i2l', - id: INPAINT_IMAGE, - is_intermediate: true, - fp32: vaePrecision === 'fp32' ? true : false, - }, - [NOISE]: { - type: 'noise', - id: NOISE, - width, - height, - use_cpu, - is_intermediate: true, + [SDXL_MODEL_LOADER]: { + type: 'sdxl_model_loader', + id: SDXL_MODEL_LOADER, + model, }, [POSITIVE_CONDITIONING]: { type: 'sdxl_compel_prompt', @@ -171,10 +108,38 @@ export const buildCanvasSDXLInpaintGraph = ( ? `${negativePrompt} ${negativeStylePrompt}` : negativeStylePrompt, }, - [SDXL_MODEL_LOADER]: { - type: 'sdxl_model_loader', - id: SDXL_MODEL_LOADER, - model, + [MASK_BLUR]: { + type: 'mask_blur', + id: MASK_BLUR, + is_intermediate: true, + radius: maskBlur, + blur_type: maskBlurMethod, + mask: canvasMaskImage, + }, + [INPAINT_IMAGE]: { + type: 'i2l', + id: INPAINT_IMAGE, + is_intermediate: true, + fp32: vaePrecision === 'fp32' ? true : false, + image: canvasInitImage, + }, + [NOISE]: { + type: 'noise', + id: NOISE, + width, + height, + use_cpu, + is_intermediate: true, + }, + [INPAINT]: { + type: 'denoise_latents', + id: INPAINT, + is_intermediate: true, + steps: steps, + cfg_scale: cfg_scale, + scheduler: scheduler, + denoising_start: 1 - strength, + denoising_end: shouldUseSDXLRefiner ? refinerStart : 1, }, [LATENTS_TO_IMAGE]: { type: 'l2i', @@ -186,11 +151,14 @@ export const buildCanvasSDXLInpaintGraph = ( type: 'color_correct', id: COLOR_CORRECT, is_intermediate: true, + reference: canvasInitImage, + mask: canvasMaskImage, }, [INPAINT_FINAL_IMAGE]: { type: 'img_paste', id: INPAINT_FINAL_IMAGE, is_intermediate: true, + base_image: canvasInitImage, }, [RANGE_OF_SIZE]: { type: 'range_of_size', @@ -258,16 +226,6 @@ export const buildCanvasSDXLInpaintGraph = ( field: 'clip2', }, }, - { - source: { - node_id: NEGATIVE_CONDITIONING, - field: 'conditioning', - }, - destination: { - node_id: INPAINT, - field: 'negative_conditioning', - }, - }, { source: { node_id: POSITIVE_CONDITIONING, @@ -278,6 +236,16 @@ export const buildCanvasSDXLInpaintGraph = ( field: 'positive_conditioning', }, }, + { + source: { + node_id: NEGATIVE_CONDITIONING, + field: 'conditioning', + }, + destination: { + node_id: INPAINT, + field: 'negative_conditioning', + }, + }, { source: { node_id: NOISE, @@ -288,16 +256,6 @@ export const buildCanvasSDXLInpaintGraph = ( field: 'noise', }, }, - { - source: { - node_id: INPAINT_INFILL, - field: 'image', - }, - destination: { - node_id: INPAINT_IMAGE, - field: 'image', - }, - }, { source: { node_id: INPAINT_IMAGE, @@ -310,29 +268,9 @@ export const buildCanvasSDXLInpaintGraph = ( }, { source: { - node_id: MASK_FROM_ALPHA, + node_id: MASK_BLUR, field: 'mask', }, - destination: { - node_id: MASK_COMBINE, - field: 'mask1', - }, - }, - { - source: { - node_id: MASK_COMBINE, - field: 'image', - }, - destination: { - node_id: MASK_BLUR, - field: 'image', - }, - }, - { - source: { - node_id: MASK_BLUR, - field: 'image', - }, destination: { node_id: INPAINT, field: 'mask', @@ -368,26 +306,6 @@ export const buildCanvasSDXLInpaintGraph = ( field: 'latents', }, }, - { - source: { - node_id: INPAINT_INFILL, - field: 'image', - }, - destination: { - node_id: COLOR_CORRECT, - field: 'reference', - }, - }, - { - source: { - node_id: MASK_BLUR, - field: 'image', - }, - destination: { - node_id: COLOR_CORRECT, - field: 'mask', - }, - }, { source: { node_id: LATENTS_TO_IMAGE, @@ -398,26 +316,6 @@ export const buildCanvasSDXLInpaintGraph = ( field: 'image', }, }, - { - source: { - node_id: INPAINT_INFILL, - field: 'image', - }, - destination: { - node_id: INPAINT_FINAL_IMAGE, - field: 'base_image', - }, - }, - { - source: { - node_id: MASK_BLUR, - field: 'image', - }, - destination: { - node_id: INPAINT_FINAL_IMAGE, - field: 'mask', - }, - }, { source: { node_id: COLOR_CORRECT, @@ -428,6 +326,16 @@ export const buildCanvasSDXLInpaintGraph = ( field: 'image', }, }, + { + source: { + node_id: MASK_BLUR, + field: 'mask', + }, + destination: { + node_id: INPAINT_FINAL_IMAGE, + field: 'mask', + }, + }, ], }; diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLOutpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLOutpaintGraph.ts new file mode 100644 index 0000000000..2b60019003 --- /dev/null +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLOutpaintGraph.ts @@ -0,0 +1,480 @@ +import { logger } from 'app/logging/logger'; +import { RootState } from 'app/store/store'; +import { NonNullableGraph } from 'features/nodes/types/types'; +import { + ImageDTO, + InfillPatchmatchInvocation, + InfillTileInvocation, + RandomIntInvocation, + RangeOfSizeInvocation, +} from 'services/api/types'; +import { addControlNetToLinearGraph } from './addControlNetToLinearGraph'; +import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph'; +import { addSDXLLoRAsToGraph } from './addSDXLLoRAstoGraph'; +import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph'; +import { addVAEToGraph } from './addVAEToGraph'; +import { addWatermarkerToGraph } from './addWatermarkerToGraph'; +import { + COLOR_CORRECT, + INPAINT, + INPAINT_FINAL_IMAGE, + INPAINT_GRAPH, + INPAINT_IMAGE, + INPAINT_INFILL, + ITERATE, + LATENTS_TO_IMAGE, + MASK_BLUR, + MASK_COMBINE, + MASK_FROM_ALPHA, + NEGATIVE_CONDITIONING, + NOISE, + POSITIVE_CONDITIONING, + RANDOM_INT, + RANGE_OF_SIZE, + SDXL_MODEL_LOADER, +} from './constants'; + +/** + * Builds the Canvas tab's Outpaint graph. + */ +export const buildCanvasSDXLOutpaintGraph = ( + state: RootState, + canvasInitImage: ImageDTO, + canvasMaskImage?: ImageDTO +): NonNullableGraph => { + const log = logger('nodes'); + const { + positivePrompt, + negativePrompt, + model, + cfgScale: cfg_scale, + scheduler, + steps, + img2imgStrength: strength, + shouldFitToWidthHeight, + iterations, + seed, + shouldRandomizeSeed, + vaePrecision, + shouldUseNoiseSettings, + shouldUseCpuNoise, + maskBlur, + maskBlurMethod, + tileSize, + infillMethod, + } = state.generation; + + const { + positiveStylePrompt, + negativeStylePrompt, + shouldConcatSDXLStylePrompt, + shouldUseSDXLRefiner, + refinerStart, + } = state.sdxl; + + if (!model) { + log.error('No model found in state'); + throw new Error('No model found in state'); + } + + // The bounding box determines width and height, not the width and height params + const { width, height } = state.canvas.boundingBoxDimensions; + + // We may need to set the inpaint width and height to scale the image + const { + scaledBoundingBoxDimensions, + boundingBoxScaleMethod, + shouldAutoSave, + } = state.canvas; + + const use_cpu = shouldUseNoiseSettings + ? shouldUseCpuNoise + : shouldUseCpuNoise; + + let infillNode: InfillTileInvocation | InfillPatchmatchInvocation = { + type: 'infill_tile', + id: INPAINT_INFILL, + is_intermediate: true, + image: canvasInitImage, + tile_size: tileSize, + }; + + if (infillMethod === 'patchmatch') { + infillNode = { + type: 'infill_patchmatch', + id: INPAINT_INFILL, + is_intermediate: true, + image: canvasInitImage, + }; + } + + const graph: NonNullableGraph = { + id: INPAINT_GRAPH, + nodes: { + [INPAINT]: { + type: 'denoise_latents', + id: INPAINT, + is_intermediate: true, + steps: steps, + cfg_scale: cfg_scale, + scheduler: scheduler, + denoising_start: 1 - strength, + denoising_end: shouldUseSDXLRefiner ? refinerStart : 1, + }, + [infillNode.id]: infillNode, + [MASK_FROM_ALPHA]: { + type: 'tomask', + id: MASK_FROM_ALPHA, + is_intermediate: true, + image: canvasInitImage, + }, + [MASK_COMBINE]: { + type: 'mask_combine', + id: MASK_COMBINE, + is_intermediate: true, + mask2: canvasMaskImage, + }, + [MASK_BLUR]: { + type: 'mask_blur', + id: MASK_BLUR, + is_intermediate: true, + radius: maskBlur, + blur_type: maskBlurMethod, + }, + [INPAINT_IMAGE]: { + type: 'i2l', + id: INPAINT_IMAGE, + is_intermediate: true, + fp32: vaePrecision === 'fp32' ? true : false, + }, + [NOISE]: { + type: 'noise', + id: NOISE, + width, + height, + use_cpu, + is_intermediate: true, + }, + [POSITIVE_CONDITIONING]: { + type: 'sdxl_compel_prompt', + id: POSITIVE_CONDITIONING, + prompt: positivePrompt, + style: shouldConcatSDXLStylePrompt + ? `${positivePrompt} ${positiveStylePrompt}` + : positiveStylePrompt, + }, + [NEGATIVE_CONDITIONING]: { + type: 'sdxl_compel_prompt', + id: NEGATIVE_CONDITIONING, + prompt: negativePrompt, + style: shouldConcatSDXLStylePrompt + ? `${negativePrompt} ${negativeStylePrompt}` + : negativeStylePrompt, + }, + [SDXL_MODEL_LOADER]: { + type: 'sdxl_model_loader', + id: SDXL_MODEL_LOADER, + model, + }, + [LATENTS_TO_IMAGE]: { + type: 'l2i', + id: LATENTS_TO_IMAGE, + is_intermediate: true, + fp32: vaePrecision === 'fp32' ? true : false, + }, + [COLOR_CORRECT]: { + type: 'color_correct', + id: COLOR_CORRECT, + is_intermediate: true, + }, + [INPAINT_FINAL_IMAGE]: { + type: 'img_paste', + id: INPAINT_FINAL_IMAGE, + is_intermediate: true, + }, + [RANGE_OF_SIZE]: { + type: 'range_of_size', + id: RANGE_OF_SIZE, + is_intermediate: true, + // seed - must be connected manually + // start: 0, + size: iterations, + step: 1, + }, + [ITERATE]: { + type: 'iterate', + id: ITERATE, + is_intermediate: true, + }, + }, + edges: [ + { + source: { + node_id: SDXL_MODEL_LOADER, + field: 'unet', + }, + destination: { + node_id: INPAINT, + field: 'unet', + }, + }, + { + source: { + node_id: SDXL_MODEL_LOADER, + field: 'clip', + }, + destination: { + node_id: POSITIVE_CONDITIONING, + field: 'clip', + }, + }, + { + source: { + node_id: SDXL_MODEL_LOADER, + field: 'clip2', + }, + destination: { + node_id: POSITIVE_CONDITIONING, + field: 'clip2', + }, + }, + { + source: { + node_id: SDXL_MODEL_LOADER, + field: 'clip', + }, + destination: { + node_id: NEGATIVE_CONDITIONING, + field: 'clip', + }, + }, + { + source: { + node_id: SDXL_MODEL_LOADER, + field: 'clip2', + }, + destination: { + node_id: NEGATIVE_CONDITIONING, + field: 'clip2', + }, + }, + { + source: { + node_id: NEGATIVE_CONDITIONING, + field: 'conditioning', + }, + destination: { + node_id: INPAINT, + field: 'negative_conditioning', + }, + }, + { + source: { + node_id: POSITIVE_CONDITIONING, + field: 'conditioning', + }, + destination: { + node_id: INPAINT, + field: 'positive_conditioning', + }, + }, + { + source: { + node_id: NOISE, + field: 'noise', + }, + destination: { + node_id: INPAINT, + field: 'noise', + }, + }, + { + source: { + node_id: INPAINT_INFILL, + field: 'image', + }, + destination: { + node_id: INPAINT_IMAGE, + field: 'image', + }, + }, + { + source: { + node_id: INPAINT_IMAGE, + field: 'latents', + }, + destination: { + node_id: INPAINT, + field: 'latents', + }, + }, + { + source: { + node_id: MASK_FROM_ALPHA, + field: 'mask', + }, + destination: { + node_id: MASK_COMBINE, + field: 'mask1', + }, + }, + { + source: { + node_id: MASK_COMBINE, + field: 'mask', + }, + destination: { + node_id: MASK_BLUR, + field: 'mask', + }, + }, + { + source: { + node_id: MASK_BLUR, + field: 'mask', + }, + destination: { + node_id: INPAINT, + field: 'mask', + }, + }, + { + source: { + node_id: RANGE_OF_SIZE, + field: 'collection', + }, + destination: { + node_id: ITERATE, + field: 'collection', + }, + }, + { + source: { + node_id: ITERATE, + field: 'item', + }, + destination: { + node_id: NOISE, + field: 'seed', + }, + }, + { + source: { + node_id: INPAINT, + field: 'latents', + }, + destination: { + node_id: LATENTS_TO_IMAGE, + field: 'latents', + }, + }, + { + source: { + node_id: INPAINT_INFILL, + field: 'image', + }, + destination: { + node_id: COLOR_CORRECT, + field: 'reference', + }, + }, + { + source: { + node_id: MASK_BLUR, + field: 'mask', + }, + destination: { + node_id: COLOR_CORRECT, + field: 'mask', + }, + }, + { + source: { + node_id: LATENTS_TO_IMAGE, + field: 'image', + }, + destination: { + node_id: COLOR_CORRECT, + field: 'image', + }, + }, + { + source: { + node_id: INPAINT_INFILL, + field: 'image', + }, + destination: { + node_id: INPAINT_FINAL_IMAGE, + field: 'base_image', + }, + }, + { + source: { + node_id: MASK_BLUR, + field: 'mask', + }, + destination: { + node_id: INPAINT_FINAL_IMAGE, + field: 'mask', + }, + }, + { + source: { + node_id: COLOR_CORRECT, + field: 'image', + }, + destination: { + node_id: INPAINT_FINAL_IMAGE, + field: 'image', + }, + }, + ], + }; + + // Add Refiner if enabled + if (shouldUseSDXLRefiner) { + addSDXLRefinerToGraph(state, graph, INPAINT); + } + + // Add VAE + addVAEToGraph(state, graph, SDXL_MODEL_LOADER); + + // handle seed + if (shouldRandomizeSeed) { + // Random int node to generate the starting seed + const randomIntNode: RandomIntInvocation = { + id: RANDOM_INT, + type: 'rand_int', + }; + + graph.nodes[RANDOM_INT] = randomIntNode; + + // Connect random int to the start of the range of size so the range starts on the random first seed + graph.edges.push({ + source: { node_id: RANDOM_INT, field: 'a' }, + destination: { node_id: RANGE_OF_SIZE, field: 'start' }, + }); + } else { + // User specified seed, so set the start of the range of size to the seed + (graph.nodes[RANGE_OF_SIZE] as RangeOfSizeInvocation).start = seed; + } + + // add LoRA support + addSDXLLoRAsToGraph(state, graph, INPAINT, SDXL_MODEL_LOADER); + + // add controlnet, mutating `graph` + addControlNetToLinearGraph(state, graph, INPAINT); + + // NSFW & watermark - must be last thing added to graph + if (state.system.shouldUseNSFWChecker) { + // must add before watermarker! + addNSFWCheckerToGraph(state, graph, INPAINT); + } + + if (state.system.shouldUseWatermarker) { + // must add after nsfw checker! + addWatermarkerToGraph(state, graph, INPAINT); + } + + return graph; +}; diff --git a/invokeai/frontend/web/src/services/api/schema.d.ts b/invokeai/frontend/web/src/services/api/schema.d.ts index b4fcf7f75c..84053db29c 100644 --- a/invokeai/frontend/web/src/services/api/schema.d.ts +++ b/invokeai/frontend/web/src/services/api/schema.d.ts @@ -1586,7 +1586,7 @@ export type components = { * @description The nodes in this graph */ nodes?: { - [key: string]: (components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageLuminosityAdjustmentInvocation"] | components["schemas"]["ImageSaturationAdjustmentInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["ONNXSD1ModelLoaderInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["ParamStringInvocation"] | components["schemas"]["ParamPromptInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"]) | undefined; + [key: string]: (components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["MaskBlurInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageLuminosityAdjustmentInvocation"] | components["schemas"]["ImageSaturationAdjustmentInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["ONNXSD1ModelLoaderInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["ParamStringInvocation"] | components["schemas"]["ParamPromptInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"]) | undefined; }; /** * Edges @@ -3273,6 +3273,47 @@ export type components = { */ model: components["schemas"]["MainModelField"]; }; + /** + * MaskBlurInvocation + * @description Blurs a mask + */ + MaskBlurInvocation: { + /** + * Id + * @description The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this node is an intermediate node. + * @default false + */ + is_intermediate?: boolean; + /** + * Type + * @default mask_blur + * @enum {string} + */ + type?: "mask_blur"; + /** + * Mask + * @description The mask image to blur + */ + mask?: components["schemas"]["ImageField"]; + /** + * Radius + * @description The blur radius + * @default 8 + */ + radius?: number; + /** + * Blur Type + * @description The type of blur + * @default gaussian + * @enum {string} + */ + blur_type?: "gaussian" | "box"; + }; /** * MaskCombineInvocation * @description Combine two masks together by multiplying them using `PIL.ImageChops.multiply()`. @@ -5780,12 +5821,24 @@ export type components = { */ image?: components["schemas"]["ImageField"]; }; + /** + * StableDiffusion1ModelFormat + * @description An enumeration. + * @enum {string} + */ + StableDiffusion1ModelFormat: "checkpoint" | "diffusers"; /** * StableDiffusionXLModelFormat * @description An enumeration. * @enum {string} */ StableDiffusionXLModelFormat: "checkpoint" | "diffusers"; + /** + * StableDiffusionOnnxModelFormat + * @description An enumeration. + * @enum {string} + */ + StableDiffusionOnnxModelFormat: "olive" | "onnx"; /** * ControlNetModelFormat * @description An enumeration. @@ -5798,18 +5851,6 @@ export type components = { * @enum {string} */ StableDiffusion2ModelFormat: "checkpoint" | "diffusers"; - /** - * StableDiffusionOnnxModelFormat - * @description An enumeration. - * @enum {string} - */ - StableDiffusionOnnxModelFormat: "olive" | "onnx"; - /** - * StableDiffusion1ModelFormat - * @description An enumeration. - * @enum {string} - */ - StableDiffusion1ModelFormat: "checkpoint" | "diffusers"; }; responses: never; parameters: never; @@ -5920,7 +5961,7 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageLuminosityAdjustmentInvocation"] | components["schemas"]["ImageSaturationAdjustmentInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["ONNXSD1ModelLoaderInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["ParamStringInvocation"] | components["schemas"]["ParamPromptInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"]; + "application/json": components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["MaskBlurInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageLuminosityAdjustmentInvocation"] | components["schemas"]["ImageSaturationAdjustmentInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["ONNXSD1ModelLoaderInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["ParamStringInvocation"] | components["schemas"]["ParamPromptInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"]; }; }; responses: { @@ -5957,7 +5998,7 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageLuminosityAdjustmentInvocation"] | components["schemas"]["ImageSaturationAdjustmentInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["ONNXSD1ModelLoaderInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["ParamStringInvocation"] | components["schemas"]["ParamPromptInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"]; + "application/json": components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["LoadImageInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["MaskBlurInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageLuminosityAdjustmentInvocation"] | components["schemas"]["ImageSaturationAdjustmentInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["ONNXSD1ModelLoaderInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["ParamIntInvocation"] | components["schemas"]["ParamFloatInvocation"] | components["schemas"]["ParamStringInvocation"] | components["schemas"]["ParamPromptInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"]; }; }; responses: {