This commit is contained in:
Qing 2024-01-05 15:31:36 +08:00
parent 311ca6fbd3
commit a95dd10ceb
2 changed files with 7 additions and 2 deletions

View File

@ -299,9 +299,7 @@ class Api:
def api_adjust_mask(self, req: AdjustMaskRequest): def api_adjust_mask(self, req: AdjustMaskRequest):
mask, _, _ = decode_base64_to_image(req.mask, gray=True) mask, _, _ = decode_base64_to_image(req.mask, gray=True)
cv2.imwrite("tmp_adjust_mask_input.png", mask)
mask = adjust_mask(mask, req.kernel_size, req.operate) mask = adjust_mask(mask, req.kernel_size, req.operate)
cv2.imwrite("tmp_adjust_mask.png", mask)
return Response(content=numpy_to_bytes(mask, "png"), media_type="image/png") return Response(content=numpy_to_bytes(mask, "png"), media_type="image/png")
def launch(self): def launch(self):

View File

@ -488,6 +488,12 @@ export const useStore = createWithEqualityFn<AppState & AppAction>()(
[maskLineGroup], [maskLineGroup],
maskImages maskImages
) )
if (useLastLineGroup) {
const temporaryMask = await canvasToImage(maskCanvas)
set((state) => {
state.editorState.temporaryMasks = castDraft([temporaryMask])
})
}
try { try {
const res = await inpaint( const res = await inpaint(
@ -525,6 +531,7 @@ export const useStore = createWithEqualityFn<AppState & AppAction>()(
get().resetRedoState() get().resetRedoState()
set((state) => { set((state) => {
state.isInpainting = false state.isInpainting = false
state.editorState.temporaryMasks = []
}) })
}, },