pix2pix allow empty mask

This commit is contained in:
Qing 2023-01-28 21:18:49 +08:00
parent 05e82598de
commit a947f864b6

View File

@ -49,6 +49,7 @@ import {
isInteractiveSegRunningState, isInteractiveSegRunningState,
isInteractiveSegState, isInteractiveSegState,
isPaintByExampleState, isPaintByExampleState,
isPix2PixState,
isSDState, isSDState,
negativePropmtState, negativePropmtState,
propmtState, propmtState,
@ -119,6 +120,7 @@ export default function Editor() {
const [isInpainting, setIsInpainting] = useRecoilState(isInpaintingState) const [isInpainting, setIsInpainting] = useRecoilState(isInpaintingState)
const runMannually = useRecoilValue(runManuallyState) const runMannually = useRecoilValue(runManuallyState)
const isDiffusionModels = useRecoilValue(isDiffusionModelsState) const isDiffusionModels = useRecoilValue(isDiffusionModelsState)
const isPix2Pix = useRecoilValue(isPix2PixState)
const [isInteractiveSeg, setIsInteractiveSeg] = useRecoilState( const [isInteractiveSeg, setIsInteractiveSeg] = useRecoilState(
isInteractiveSegState isInteractiveSegState
) )
@ -260,8 +262,11 @@ export default function Editor() {
) )
const hadDrawSomething = useCallback(() => { const hadDrawSomething = useCallback(() => {
if (isPix2Pix) {
return true
}
return curLineGroup.length !== 0 return curLineGroup.length !== 0
}, [curLineGroup]) }, [curLineGroup, isPix2Pix])
const drawOnCurrentRender = useCallback( const drawOnCurrentRender = useCallback(
(lineGroup: LineGroup) => { (lineGroup: LineGroup) => {
@ -426,6 +431,8 @@ export default function Editor() {
} else if (prevInteractiveSegMask) { } else if (prevInteractiveSegMask) {
// 使用上一次 IS 的 mask 生成 // 使用上一次 IS 的 mask 生成
runInpainting(false, undefined, prevInteractiveSegMask) runInpainting(false, undefined, prevInteractiveSegMask)
} else if (isPix2Pix) {
runInpainting(false, undefined, null)
} else { } else {
setToastState({ setToastState({
open: true, open: true,