mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Adds support for inpaint_replace
This commit is contained in:
parent
4039e9e368
commit
4cf9c965d4
483
frontend/dist/assets/index.0a6593a2.js
vendored
483
frontend/dist/assets/index.0a6593a2.js
vendored
File diff suppressed because one or more lines are too long
1
frontend/dist/assets/index.193aec6f.css
vendored
1
frontend/dist/assets/index.193aec6f.css
vendored
File diff suppressed because one or more lines are too long
517
frontend/dist/assets/index.38ff1a03.js
vendored
517
frontend/dist/assets/index.38ff1a03.js
vendored
File diff suppressed because one or more lines are too long
517
frontend/dist/assets/index.4150d00b.js
vendored
Normal file
517
frontend/dist/assets/index.4150d00b.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
frontend/dist/assets/index.44f7d837.css
vendored
Normal file
1
frontend/dist/assets/index.44f7d837.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
frontend/dist/assets/index.8391cc9a.css
vendored
1
frontend/dist/assets/index.8391cc9a.css
vendored
File diff suppressed because one or more lines are too long
6
frontend/dist/index.html
vendored
6
frontend/dist/index.html
vendored
@ -5,9 +5,9 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>InvokeAI - A Stable Diffusion Toolkit</title>
|
<title>InvokeAI - A Stable Diffusion Toolkit</title>
|
||||||
<link rel="shortcut icon" type="icon" href="/assets/favicon.0d253ced.ico" />
|
<link rel="shortcut icon" type="icon" href="./assets/favicon.0d253ced.ico" />
|
||||||
<script type="module" crossorigin src="/assets/index.38ff1a03.js"></script>
|
<script type="module" crossorigin src="./assets/index.4150d00b.js"></script>
|
||||||
<link rel="stylesheet" href="/assets/index.8391cc9a.css">
|
<link rel="stylesheet" href="./assets/index.44f7d837.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -102,6 +102,8 @@ export const frontendToBackendParameters = (
|
|||||||
boundingBoxCoordinate: { x, y },
|
boundingBoxCoordinate: { x, y },
|
||||||
boundingBoxDimensions: { width, height },
|
boundingBoxDimensions: { width, height },
|
||||||
shouldShowBoundingBox,
|
shouldShowBoundingBox,
|
||||||
|
inpaintReplace,
|
||||||
|
shouldUseInpaintReplace,
|
||||||
} = inpaintingState;
|
} = inpaintingState;
|
||||||
|
|
||||||
let bx = x,
|
let bx = x,
|
||||||
@ -123,6 +125,10 @@ export const frontendToBackendParameters = (
|
|||||||
height: bheight,
|
height: bheight,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (shouldUseInpaintReplace) {
|
||||||
|
generationParameters.inpaint_replace = inpaintReplace;
|
||||||
|
}
|
||||||
|
|
||||||
generationParameters.init_img = imageToProcessUrl;
|
generationParameters.init_img = imageToProcessUrl;
|
||||||
generationParameters.strength = img2imgStrength;
|
generationParameters.strength = img2imgStrength;
|
||||||
generationParameters.fit = false;
|
generationParameters.fit = false;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useToast } from '@chakra-ui/react';
|
import { useToast } from '@chakra-ui/react';
|
||||||
import { createSelector } from '@reduxjs/toolkit';
|
import { createSelector } from '@reduxjs/toolkit';
|
||||||
import React from 'react';
|
import React, { ChangeEvent } from 'react';
|
||||||
import {
|
import {
|
||||||
RootState,
|
RootState,
|
||||||
useAppDispatch,
|
useAppDispatch,
|
||||||
@ -10,17 +10,24 @@ import IAIButton from '../../../../common/components/IAIButton';
|
|||||||
import {
|
import {
|
||||||
InpaintingState,
|
InpaintingState,
|
||||||
setClearBrushHistory,
|
setClearBrushHistory,
|
||||||
|
setInpaintReplace,
|
||||||
|
setShouldUseInpaintReplace,
|
||||||
} from '../../../tabs/Inpainting/inpaintingSlice';
|
} from '../../../tabs/Inpainting/inpaintingSlice';
|
||||||
import BoundingBoxSettings from './BoundingBoxSettings';
|
import BoundingBoxSettings from './BoundingBoxSettings';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import IAINumberInput from '../../../../common/components/IAINumberInput';
|
||||||
|
import IAISwitch from '../../../../common/components/IAISwitch';
|
||||||
|
|
||||||
const inpaintingSelector = createSelector(
|
const inpaintingSelector = createSelector(
|
||||||
(state: RootState) => state.inpainting,
|
(state: RootState) => state.inpainting,
|
||||||
(inpainting: InpaintingState) => {
|
(inpainting: InpaintingState) => {
|
||||||
const { pastLines, futureLines } = inpainting;
|
const { pastLines, futureLines, inpaintReplace, shouldUseInpaintReplace } =
|
||||||
|
inpainting;
|
||||||
return {
|
return {
|
||||||
pastLines,
|
pastLines,
|
||||||
futureLines,
|
futureLines,
|
||||||
|
inpaintReplace,
|
||||||
|
shouldUseInpaintReplace,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -34,7 +41,8 @@ export default function InpaintingSettings() {
|
|||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
|
||||||
const { pastLines, futureLines } = useAppSelector(inpaintingSelector);
|
const { pastLines, futureLines, inpaintReplace, shouldUseInpaintReplace } =
|
||||||
|
useAppSelector(inpaintingSelector);
|
||||||
|
|
||||||
const handleClearBrushHistory = () => {
|
const handleClearBrushHistory = () => {
|
||||||
dispatch(setClearBrushHistory());
|
dispatch(setClearBrushHistory());
|
||||||
@ -54,6 +62,28 @@ export default function InpaintingSettings() {
|
|||||||
tooltip="Clears brush stroke history"
|
tooltip="Clears brush stroke history"
|
||||||
disabled={futureLines.length > 0 || pastLines.length > 0 ? false : true}
|
disabled={futureLines.length > 0 || pastLines.length > 0 ? false : true}
|
||||||
/>
|
/>
|
||||||
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||||
|
<IAINumberInput
|
||||||
|
label="Inpaint Replace"
|
||||||
|
value={inpaintReplace}
|
||||||
|
min={0}
|
||||||
|
max={1.0}
|
||||||
|
step={0.05}
|
||||||
|
width={'auto'}
|
||||||
|
formControlProps={{ style: { paddingRight: '1rem' } }}
|
||||||
|
isInteger={false}
|
||||||
|
isDisabled={!shouldUseInpaintReplace}
|
||||||
|
onChange={(v: number) => {
|
||||||
|
dispatch(setInpaintReplace(v));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<IAISwitch
|
||||||
|
isChecked={shouldUseInpaintReplace}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
dispatch(setShouldUseInpaintReplace(e.target.checked))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,8 @@ export interface InpaintingState {
|
|||||||
needsRepaint: boolean;
|
needsRepaint: boolean;
|
||||||
stageScale: number;
|
stageScale: number;
|
||||||
isDrawing: boolean;
|
isDrawing: boolean;
|
||||||
|
shouldUseInpaintReplace: boolean;
|
||||||
|
inpaintReplace: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialInpaintingState: InpaintingState = {
|
const initialInpaintingState: InpaintingState = {
|
||||||
@ -79,6 +81,8 @@ const initialInpaintingState: InpaintingState = {
|
|||||||
needsRepaint: false,
|
needsRepaint: false,
|
||||||
isDrawing: false,
|
isDrawing: false,
|
||||||
stageScale: 1,
|
stageScale: 1,
|
||||||
|
shouldUseInpaintReplace: false,
|
||||||
|
inpaintReplace: 0.5,
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialState: InpaintingState = initialInpaintingState;
|
const initialState: InpaintingState = initialInpaintingState;
|
||||||
@ -251,7 +255,7 @@ export const inpaintingSlice = createSlice({
|
|||||||
64,
|
64,
|
||||||
roundedCanvasHeight
|
roundedCanvasHeight
|
||||||
);
|
);
|
||||||
console.log(overflowX, boundingBoxX, boundingBoxX - overflowX);
|
|
||||||
const overflowCorrectedX =
|
const overflowCorrectedX =
|
||||||
overflowX > 0 ? boundingBoxX - overflowX : boundingBoxX;
|
overflowX > 0 ? boundingBoxX - overflowX : boundingBoxX;
|
||||||
|
|
||||||
@ -319,6 +323,12 @@ export const inpaintingSlice = createSlice({
|
|||||||
state.pastLines = [];
|
state.pastLines = [];
|
||||||
state.futureLines = [];
|
state.futureLines = [];
|
||||||
},
|
},
|
||||||
|
setShouldUseInpaintReplace: (state, action: PayloadAction<boolean>) => {
|
||||||
|
state.shouldUseInpaintReplace = action.payload;
|
||||||
|
},
|
||||||
|
setInpaintReplace: (state, action: PayloadAction<number>) => {
|
||||||
|
state.inpaintReplace = action.payload;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -352,6 +362,8 @@ export const {
|
|||||||
setShouldShowBrush,
|
setShouldShowBrush,
|
||||||
setShouldShowBoundingBox,
|
setShouldShowBoundingBox,
|
||||||
setClearBrushHistory,
|
setClearBrushHistory,
|
||||||
|
setShouldUseInpaintReplace,
|
||||||
|
setInpaintReplace,
|
||||||
} = inpaintingSlice.actions;
|
} = inpaintingSlice.actions;
|
||||||
|
|
||||||
export default inpaintingSlice.reducer;
|
export default inpaintingSlice.reducer;
|
||||||
|
@ -3,6 +3,8 @@ import { MaskLine } from '../inpaintingSlice';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts canvas into pixel buffer and checks if it is empty (all pixels full alpha).
|
* Converts canvas into pixel buffer and checks if it is empty (all pixels full alpha).
|
||||||
|
*
|
||||||
|
* I DON' THINK THIS WORKS ACTUALLY
|
||||||
*/
|
*/
|
||||||
const checkIsMaskEmpty = (image: HTMLImageElement, lines: MaskLine[]) => {
|
const checkIsMaskEmpty = (image: HTMLImageElement, lines: MaskLine[]) => {
|
||||||
const offscreenContainer = document.createElement('div');
|
const offscreenContainer = document.createElement('div');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user