BertChristiaens commited on
Commit
f6b9c19
1 Parent(s): 5a67d9b

add masking

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -168,8 +168,14 @@ def make_editing_canvas(canvas_color, brush, _reset_state, generation_mode, pain
168
 
169
  if st.button("generate image", key='generate_button'):
170
  image = get_image()
171
- real_seg = segment_image(Image.fromarray(image))
172
- mask, seg = preprocess_seg_mask(canvas, real_seg)
 
 
 
 
 
 
173
 
174
  with st.spinner(text="Generating image"):
175
  result_image = make_image_controlnet(image=image,
 
168
 
169
  if st.button("generate image", key='generate_button'):
170
  image = get_image()
171
+ print(chosen_colors)
172
+
173
+ segmentation = st.session_state['seg']
174
+ mask = np.zeros_like(segmentation)
175
+ for color in chosen_colors:
176
+ # if the color is in the segmentation, set mask to 1
177
+ mask[np.where((segmentation == color).all(axis=2))] = 1
178
+ print(mask)
179
 
180
  with st.spinner(text="Generating image"):
181
  result_image = make_image_controlnet(image=image,