mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): do not run HRO if using an initial image
This commit is contained in:
committed by
Kent Keirsey
parent
68d1458c83
commit
4beccea6e7
@ -6,11 +6,14 @@ import { assert } from 'tsafe';
|
|||||||
|
|
||||||
import { IMAGE_TO_LATENTS, NOISE, RESIZE } from './constants';
|
import { IMAGE_TO_LATENTS, NOISE, RESIZE } from './constants';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if an initial image was added, false if not.
|
||||||
|
*/
|
||||||
export const addInitialImageToLinearGraph = (
|
export const addInitialImageToLinearGraph = (
|
||||||
state: RootState,
|
state: RootState,
|
||||||
graph: NonNullableGraph,
|
graph: NonNullableGraph,
|
||||||
denoiseNodeId: string
|
denoiseNodeId: string
|
||||||
): void => {
|
): boolean => {
|
||||||
// Remove Existing UNet Connections
|
// Remove Existing UNet Connections
|
||||||
const { img2imgStrength, vaePrecision, model } = state.generation;
|
const { img2imgStrength, vaePrecision, model } = state.generation;
|
||||||
const { refinerModel, refinerStart } = state.sdxl;
|
const { refinerModel, refinerStart } = state.sdxl;
|
||||||
@ -19,7 +22,7 @@ export const addInitialImageToLinearGraph = (
|
|||||||
const initialImage = initialImageLayer?.isEnabled ? initialImageLayer?.image : null;
|
const initialImage = initialImageLayer?.isEnabled ? initialImageLayer?.image : null;
|
||||||
|
|
||||||
if (!initialImage) {
|
if (!initialImage) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isSDXL = model?.base === 'sdxl';
|
const isSDXL = model?.base === 'sdxl';
|
||||||
@ -122,4 +125,6 @@ export const addInitialImageToLinearGraph = (
|
|||||||
strength: img2imgStrength,
|
strength: img2imgStrength,
|
||||||
init_image: initialImage.imageName,
|
init_image: initialImage.imageName,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
@ -232,7 +232,7 @@ export const buildGenerationTabGraph = async (state: RootState): Promise<NonNull
|
|||||||
LATENTS_TO_IMAGE
|
LATENTS_TO_IMAGE
|
||||||
);
|
);
|
||||||
|
|
||||||
addInitialImageToLinearGraph(state, graph, DENOISE_LATENTS);
|
const didAddInitialImage = addInitialImageToLinearGraph(state, graph, DENOISE_LATENTS);
|
||||||
|
|
||||||
// Add Seamless To Graph
|
// Add Seamless To Graph
|
||||||
if (seamlessXAxis || seamlessYAxis) {
|
if (seamlessXAxis || seamlessYAxis) {
|
||||||
@ -249,7 +249,7 @@ export const buildGenerationTabGraph = async (state: RootState): Promise<NonNull
|
|||||||
await addControlLayersToGraph(state, graph, DENOISE_LATENTS);
|
await addControlLayersToGraph(state, graph, DENOISE_LATENTS);
|
||||||
|
|
||||||
// High resolution fix.
|
// High resolution fix.
|
||||||
if (state.hrf.hrfEnabled) {
|
if (state.hrf.hrfEnabled && !didAddInitialImage) {
|
||||||
addHrfToGraph(state, graph);
|
addHrfToGraph(state, graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user