jiuface commited on
Commit
a4143d8
1 Parent(s): 7a8b6d6

add mask blur feature

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -112,6 +112,8 @@ def process(
112
  input_image_editor: dict,
113
  image_url: str,
114
  mask_url: str,
 
 
115
  lora_path: str,
116
  lora_weights: str,
117
  lora_scale: float,
@@ -152,6 +154,8 @@ def process(
152
  if not mask:
153
  gr.Info("Please draw a mask on the image.")
154
  return None, None
 
 
155
 
156
  with calculateDuration("resize image"):
157
  width, height = resize_image_dimensions(original_resolution_wh=image.size)
@@ -268,6 +272,15 @@ with gr.Blocks() as demo:
268
  randomize_seed_checkbox_component = gr.Checkbox(
269
  label="Randomize seed", value=True)
270
 
 
 
 
 
 
 
 
 
 
271
  with gr.Row():
272
  strength_slider_component = gr.Slider(
273
  label="Strength",
@@ -302,6 +315,8 @@ with gr.Blocks() as demo:
302
  input_image_editor_component,
303
  image_url,
304
  mask_url,
 
 
305
  lora_path,
306
  lora_weights,
307
  lora_scale,
 
112
  input_image_editor: dict,
113
  image_url: str,
114
  mask_url: str,
115
+ blur_mask: bool,
116
+ blur_factor: int,
117
  lora_path: str,
118
  lora_weights: str,
119
  lora_scale: float,
 
154
  if not mask:
155
  gr.Info("Please draw a mask on the image.")
156
  return None, None
157
+ if blur_mask:
158
+ mask = pipe.mask_processor.blur(mask, blur_factor=blur_factor)
159
 
160
  with calculateDuration("resize image"):
161
  width, height = resize_image_dimensions(original_resolution_wh=image.size)
 
272
  randomize_seed_checkbox_component = gr.Checkbox(
273
  label="Randomize seed", value=True)
274
 
275
+ blur_mask = gr.Checkbox(
276
+ label="if blur mask", value=False)
277
+ blur_factor = gr.Slider(
278
+ label="blur factor",
279
+ minimum=0,
280
+ maximum=50,
281
+ step=1,
282
+ value=33,
283
+ )
284
  with gr.Row():
285
  strength_slider_component = gr.Slider(
286
  label="Strength",
 
315
  input_image_editor_component,
316
  image_url,
317
  mask_url,
318
+ blur_mask,
319
+ blur_factor,
320
  lora_path,
321
  lora_weights,
322
  lora_scale,