mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Add Infill Method support
This commit is contained in:
parent
58a48bf197
commit
d7d6298ec0
@ -3,6 +3,8 @@ import { RootState } from 'app/store/store';
|
||||
import { NonNullableGraph } from 'features/nodes/types/types';
|
||||
import {
|
||||
ImageDTO,
|
||||
InfillPatchmatchInvocation,
|
||||
InfillTileInvocation,
|
||||
RandomIntInvocation,
|
||||
RangeOfSizeInvocation,
|
||||
} from 'services/api/types';
|
||||
@ -18,6 +20,7 @@ import {
|
||||
INPAINT_FINAL_IMAGE,
|
||||
INPAINT_GRAPH,
|
||||
INPAINT_IMAGE,
|
||||
INPAINT_INFILL,
|
||||
ITERATE,
|
||||
LATENTS_TO_IMAGE,
|
||||
MAIN_MODEL_LOADER,
|
||||
@ -60,6 +63,8 @@ export const buildCanvasInpaintGraph = (
|
||||
clipSkip,
|
||||
} = state.generation;
|
||||
|
||||
const { generationMode } = state.canvas;
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
@ -79,6 +84,23 @@ 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: {
|
||||
@ -92,11 +114,11 @@ export const buildCanvasInpaintGraph = (
|
||||
denoising_start: 1 - strength,
|
||||
denoising_end: 1,
|
||||
},
|
||||
[infillNode.id]: infillNode,
|
||||
[INPAINT_IMAGE]: {
|
||||
type: 'i2l',
|
||||
id: INPAINT_IMAGE,
|
||||
is_intermediate: true,
|
||||
image: canvasInitImage,
|
||||
fp32: vaePrecision === 'fp32' ? true : false,
|
||||
},
|
||||
[NOISE]: {
|
||||
@ -244,6 +266,16 @@ export const buildCanvasInpaintGraph = (
|
||||
field: 'noise',
|
||||
},
|
||||
},
|
||||
{
|
||||
source: {
|
||||
node_id: INPAINT_INFILL,
|
||||
field: 'image',
|
||||
},
|
||||
destination: {
|
||||
node_id: INPAINT_IMAGE,
|
||||
field: 'image',
|
||||
},
|
||||
},
|
||||
{
|
||||
source: {
|
||||
node_id: INPAINT_IMAGE,
|
||||
|
@ -20,7 +20,7 @@ export const RESIZE = 'resize_image';
|
||||
export const INPAINT = 'inpaint';
|
||||
export const INPAINT_SEAM_FIX = 'inpaint_seam_fix';
|
||||
export const INPAINT_IMAGE = 'inpaint_image';
|
||||
export const INFILL_TILE = 'infill_tile';
|
||||
export const INPAINT_INFILL = 'inpaint_infill';
|
||||
export const INPAINT_FINAL_IMAGE = 'inpaint_final_image';
|
||||
export const MASK_FROM_ALPHA = 'tomask';
|
||||
export const MASK_EDGE = 'mask_edge';
|
||||
|
@ -172,6 +172,12 @@ export type ESRGANInvocation = TypeReq<
|
||||
export type DivideInvocation = TypeReq<
|
||||
components['schemas']['DivideInvocation']
|
||||
>;
|
||||
export type InfillTileInvocation = TypeReq<
|
||||
components['schemas']['InfillTileInvocation']
|
||||
>;
|
||||
export type InfillPatchmatchInvocation = TypeReq<
|
||||
components['schemas']['InfillPatchMatchInvocation']
|
||||
>;
|
||||
export type ImageNSFWBlurInvocation = TypeReq<
|
||||
components['schemas']['ImageNSFWBlurInvocation']
|
||||
>;
|
||||
|
Loading…
Reference in New Issue
Block a user