From a947f864b6fcc546897fa5edde2ac205524c14e3 Mon Sep 17 00:00:00 2001 From: Qing Date: Sat, 28 Jan 2023 21:18:49 +0800 Subject: [PATCH] pix2pix allow empty mask --- lama_cleaner/app/src/components/Editor/Editor.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lama_cleaner/app/src/components/Editor/Editor.tsx b/lama_cleaner/app/src/components/Editor/Editor.tsx index 7b34ae8..20e6e78 100644 --- a/lama_cleaner/app/src/components/Editor/Editor.tsx +++ b/lama_cleaner/app/src/components/Editor/Editor.tsx @@ -49,6 +49,7 @@ import { isInteractiveSegRunningState, isInteractiveSegState, isPaintByExampleState, + isPix2PixState, isSDState, negativePropmtState, propmtState, @@ -119,6 +120,7 @@ export default function Editor() { const [isInpainting, setIsInpainting] = useRecoilState(isInpaintingState) const runMannually = useRecoilValue(runManuallyState) const isDiffusionModels = useRecoilValue(isDiffusionModelsState) + const isPix2Pix = useRecoilValue(isPix2PixState) const [isInteractiveSeg, setIsInteractiveSeg] = useRecoilState( isInteractiveSegState ) @@ -260,8 +262,11 @@ export default function Editor() { ) const hadDrawSomething = useCallback(() => { + if (isPix2Pix) { + return true + } return curLineGroup.length !== 0 - }, [curLineGroup]) + }, [curLineGroup, isPix2Pix]) const drawOnCurrentRender = useCallback( (lineGroup: LineGroup) => { @@ -426,6 +431,8 @@ export default function Editor() { } else if (prevInteractiveSegMask) { // 使用上一次 IS 的 mask 生成 runInpainting(false, undefined, prevInteractiveSegMask) + } else if (isPix2Pix) { + runInpainting(false, undefined, null) } else { setToastState({ open: true,