feat(ui): img2img implementation

This commit is contained in:
maryhipp 2023-03-30 10:32:42 -07:00 committed by psychedelicious
parent 40b2d2b05b
commit 2db2c986d1
4 changed files with 11 additions and 5 deletions

View File

@ -124,6 +124,7 @@ export declare type Image = {
category: GalleryCategory;
isBase64?: boolean;
dreamPrompt?: 'string';
name?: string;
};
// GalleryImages is an array of Image.

View File

@ -95,6 +95,7 @@ const makeSocketIOListeners = (
width: 512,
height: 512,
category: 'result',
name: data.result.image.image_name,
mtime: new Date().getTime(),
},
})

View File

@ -3,13 +3,16 @@ import { v4 as uuidv4 } from 'uuid';
import { RootState } from 'app/store';
import { InvokeTabName, tabMap } from 'features/ui/store/tabMap';
import { Graph } from 'services/api';
import { buildTxt2ImgNode } from './buildNodes';
import { buildImg2ImgNode, buildTxt2ImgNode } from './buildNodes';
function mapTabToFunction(activeTabName: InvokeTabName) {
switch (activeTabName) {
case 'txt2img':
return buildTxt2ImgNode;
case 'img2img':
return buildImg2ImgNode;
default:
return buildTxt2ImgNode;
}

View File

@ -6,6 +6,8 @@ import {
UpscaleInvocation,
} from 'services/api';
import { Image } from 'app/invokeai';
// fe todo fix model type (frontend uses null, backend uses undefined)
// fe todo update front end to store to have whole image field (vs just name)
// be todo add symmetry fields
@ -50,7 +52,7 @@ export function buildImg2ImgNode(
): Omit<ImageToImageInvocation, 'id'> {
const { generation, system } = state;
const { shouldDisplayInProgressType, openModel: model } = system;
const { shouldDisplayInProgressType, model } = system;
const {
prompt,
@ -76,11 +78,10 @@ export function buildImg2ImgNode(
cfg_scale: cfgScale,
sampler_name: sampler as ImageToImageInvocation['sampler_name'],
seamless,
model: model as string | undefined,
model,
progress_images: shouldDisplayInProgressType === 'full-res',
image: {
image_name:
typeof initialImage === 'string' ? initialImage : initialImage?.url,
image_name: (initialImage as Image).name,
},
strength,
fit,