mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): img2img implementation
This commit is contained in:
parent
40b2d2b05b
commit
2db2c986d1
1
invokeai/frontend/web/src/app/invokeai.d.ts
vendored
1
invokeai/frontend/web/src/app/invokeai.d.ts
vendored
@ -124,6 +124,7 @@ export declare type Image = {
|
|||||||
category: GalleryCategory;
|
category: GalleryCategory;
|
||||||
isBase64?: boolean;
|
isBase64?: boolean;
|
||||||
dreamPrompt?: 'string';
|
dreamPrompt?: 'string';
|
||||||
|
name?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// GalleryImages is an array of Image.
|
// GalleryImages is an array of Image.
|
||||||
|
@ -95,6 +95,7 @@ const makeSocketIOListeners = (
|
|||||||
width: 512,
|
width: 512,
|
||||||
height: 512,
|
height: 512,
|
||||||
category: 'result',
|
category: 'result',
|
||||||
|
name: data.result.image.image_name,
|
||||||
mtime: new Date().getTime(),
|
mtime: new Date().getTime(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -3,13 +3,16 @@ import { v4 as uuidv4 } from 'uuid';
|
|||||||
import { RootState } from 'app/store';
|
import { RootState } from 'app/store';
|
||||||
import { InvokeTabName, tabMap } from 'features/ui/store/tabMap';
|
import { InvokeTabName, tabMap } from 'features/ui/store/tabMap';
|
||||||
import { Graph } from 'services/api';
|
import { Graph } from 'services/api';
|
||||||
import { buildTxt2ImgNode } from './buildNodes';
|
import { buildImg2ImgNode, buildTxt2ImgNode } from './buildNodes';
|
||||||
|
|
||||||
function mapTabToFunction(activeTabName: InvokeTabName) {
|
function mapTabToFunction(activeTabName: InvokeTabName) {
|
||||||
switch (activeTabName) {
|
switch (activeTabName) {
|
||||||
case 'txt2img':
|
case 'txt2img':
|
||||||
return buildTxt2ImgNode;
|
return buildTxt2ImgNode;
|
||||||
|
|
||||||
|
case 'img2img':
|
||||||
|
return buildImg2ImgNode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return buildTxt2ImgNode;
|
return buildTxt2ImgNode;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import {
|
|||||||
UpscaleInvocation,
|
UpscaleInvocation,
|
||||||
} from 'services/api';
|
} from 'services/api';
|
||||||
|
|
||||||
|
import { Image } from 'app/invokeai';
|
||||||
|
|
||||||
// fe todo fix model type (frontend uses null, backend uses undefined)
|
// 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)
|
// fe todo update front end to store to have whole image field (vs just name)
|
||||||
// be todo add symmetry fields
|
// be todo add symmetry fields
|
||||||
@ -50,7 +52,7 @@ export function buildImg2ImgNode(
|
|||||||
): Omit<ImageToImageInvocation, 'id'> {
|
): Omit<ImageToImageInvocation, 'id'> {
|
||||||
const { generation, system } = state;
|
const { generation, system } = state;
|
||||||
|
|
||||||
const { shouldDisplayInProgressType, openModel: model } = system;
|
const { shouldDisplayInProgressType, model } = system;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
prompt,
|
prompt,
|
||||||
@ -76,11 +78,10 @@ export function buildImg2ImgNode(
|
|||||||
cfg_scale: cfgScale,
|
cfg_scale: cfgScale,
|
||||||
sampler_name: sampler as ImageToImageInvocation['sampler_name'],
|
sampler_name: sampler as ImageToImageInvocation['sampler_name'],
|
||||||
seamless,
|
seamless,
|
||||||
model: model as string | undefined,
|
model,
|
||||||
progress_images: shouldDisplayInProgressType === 'full-res',
|
progress_images: shouldDisplayInProgressType === 'full-res',
|
||||||
image: {
|
image: {
|
||||||
image_name:
|
image_name: (initialImage as Image).name,
|
||||||
typeof initialImage === 'string' ? initialImage : initialImage?.url,
|
|
||||||
},
|
},
|
||||||
strength,
|
strength,
|
||||||
fit,
|
fit,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user