Skip to content

Commit

Permalink
fix(api): correctly handle completely black mask images
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Nov 25, 2023
1 parent d78e843 commit 1818a36
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/onnx_web/diffusers/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,12 @@ def run_inpaint_pipeline(
logger.debug("border zero: %s", border.isZero())
full_res_inpaint = full_res_inpaint and border.isZero()
if full_res_inpaint:
mask_left, mask_top, mask_right, mask_bottom = mask.getbbox()
logger.debug("mask bbox: %s", mask.getbbox())
bbox = mask.getbbox()
if bbox is None:
bbox = (0, 0, source.width, source.height)

logger.debug("mask bounding box: %s", bbox)
mask_left, mask_top, mask_right, mask_bottom = bbox
mask_width = mask_right - mask_left
mask_height = mask_bottom - mask_top
# ensure we have some padding around the mask when we do the inpaint (and that the region size is even)
Expand Down

0 comments on commit 1818a36

Please sign in to comment.