SkalskiP commited on
Commit
20fd04d
1 Parent(s): 5a2b31b
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -170,18 +170,12 @@ def process(
170
  width, height = calculate_image_dimensions_for_flux(original_resolution_wh=image.size)
171
  image = image.resize((width, height), Image.LANCZOS)
172
  mask = mask.resize((width, height), Image.LANCZOS)
173
- if mask_inflation_slider:
174
- mask_array = np.array(mask)
175
- kernel = np.ones((mask_inflation_slider, mask_inflation_slider), np.uint8)
176
- mask_array = cv2.dilate(mask_array, kernel, iterations=1)
177
- mask = Image.fromarray(mask_array)
178
- if mask_blur_slider:
179
- mask = mask.filter(ImageFilter.GaussianBlur(radius=mask_blur_slider))
180
 
181
  if randomize_seed_checkbox:
182
  seed_slicer = random.randint(0, MAX_SEED)
183
  generator = torch.Generator().manual_seed(seed_slicer)
184
- result = pipe(
185
  prompt=inpainting_prompt_text,
186
  image=image,
187
  mask_image=mask,
 
170
  width, height = calculate_image_dimensions_for_flux(original_resolution_wh=image.size)
171
  image = image.resize((width, height), Image.LANCZOS)
172
  mask = mask.resize((width, height), Image.LANCZOS)
173
+ mask = process_mask(mask, mask_inflation=mask_inflation_slider, mask_blur=mask_blur_slider)
 
 
 
 
 
 
174
 
175
  if randomize_seed_checkbox:
176
  seed_slicer = random.randint(0, MAX_SEED)
177
  generator = torch.Generator().manual_seed(seed_slicer)
178
+ result = PIPE(
179
  prompt=inpainting_prompt_text,
180
  image=image,
181
  mask_image=mask,