DawnC commited on
Commit
ced4948
·
verified ·
1 Parent(s): 3007ca0

Update inpainting_module.py

Browse files
Files changed (1) hide show
  1. inpainting_module.py +5 -5
inpainting_module.py CHANGED
@@ -508,14 +508,14 @@ class InpaintingModule:
508
  canny_array = np.array(canny_image)
509
  mask_array = np.array(mask.convert('L'))
510
 
511
- # In masked region, reduce Canny edge strength by 80%
512
  # This prevents ControlNet from locking original colors
513
  mask_region = mask_array > 128 # White = masked area
514
- canny_array[mask_region] = (canny_array[mask_region] * 0.2).astype(np.uint8)
515
- # ↑ Keep 20% edge strength for basic shape preservation
516
 
517
  canny_image = Image.fromarray(canny_array)
518
- logger.info("Applied mask-aware ControlNet: weakened edges in masked region by 80%")
519
 
520
  return canny_image
521
 
@@ -917,7 +917,7 @@ class InpaintingModule:
917
 
918
  # Conditional prompt enhancement based on template
919
  # Check if we should enhance the prompt or use it directly
920
- should_enhance = kwargs.get('enhance_prompt', True) # Default: enhance
921
 
922
  if should_enhance:
923
  if progress_callback:
 
508
  canny_array = np.array(canny_image)
509
  mask_array = np.array(mask.convert('L'))
510
 
511
+ # In masked region, completely suppress Canny edges
512
  # This prevents ControlNet from locking original colors
513
  mask_region = mask_array > 128 # White = masked area
514
+ canny_array[mask_region] = 0
515
+ # ↑ Complete suppression gives prompt maximum control over color transformation
516
 
517
  canny_image = Image.fromarray(canny_array)
518
+ logger.info("Applied mask-aware ControlNet: suppressed edges in masked region completely")
519
 
520
  return canny_image
521
 
 
917
 
918
  # Conditional prompt enhancement based on template
919
  # Check if we should enhance the prompt or use it directly
920
+ should_enhance = kwargs.get('enhance_prompt', False) # Default: no enhancement
921
 
922
  if should_enhance:
923
  if progress_callback: