rdjarbeng commited on
Commit
04c67c9
·
1 Parent(s): fa53dbf

add default alpha_matting

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -28,6 +28,15 @@ def remove_background(input_image, bg_color, model_name, alpha_matting, post_pro
28
  "post_process_mask": post_process_mask,
29
  "only_mask": only_mask
30
  }
 
 
 
 
 
 
 
 
 
31
 
32
  # Use the remove function
33
  if session or bg_color_rgba:
 
28
  "post_process_mask": post_process_mask,
29
  "only_mask": only_mask
30
  }
31
+
32
+ # Add alpha matting parameters if enabled
33
+ if alpha_matting:
34
+ remove_kwargs.update({
35
+ "alpha_matting": True,
36
+ "alpha_matting_foreground_threshold": 270,
37
+ "alpha_matting_background_threshold": 20,
38
+ "alpha_matting_erode_size": 11
39
+ })
40
 
41
  # Use the remove function
42
  if session or bg_color_rgba: