Spaces:
Running
on
Zero
Running
on
Zero
Update inpainting_module.py
Browse files- 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,
|
| 512 |
# This prevents ControlNet from locking original colors
|
| 513 |
mask_region = mask_array > 128 # White = masked area
|
| 514 |
-
canny_array[mask_region] =
|
| 515 |
-
# ↑
|
| 516 |
|
| 517 |
canny_image = Image.fromarray(canny_array)
|
| 518 |
-
logger.info("Applied mask-aware ControlNet:
|
| 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',
|
| 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:
|