BertChristiaens commited on
Commit
2379311
1 Parent(s): f6b9c19

add colors

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -158,12 +158,17 @@ def make_editing_canvas(canvas_color, brush, _reset_state, generation_mode, pain
158
  st.session_state['seg'] = real_seg
159
 
160
  if 'unique_colors' not in st.session_state:
 
161
  unique_colors = np.unique(real_seg.reshape(-1, real_seg.shape[2]), axis=0)
162
  unique_colors = [tuple(color) for color in unique_colors]
163
  st.session_state['unique_colors'] = unique_colors
164
 
165
  chosen_colors = st.multiselect(
166
- label="Choose colors", options=unique_colors, default=None, key='unique_colors', format_func=map_colors_rgb
 
 
 
 
167
  )
168
 
169
  if st.button("generate image", key='generate_button'):
 
158
  st.session_state['seg'] = real_seg
159
 
160
  if 'unique_colors' not in st.session_state:
161
+ real_seg = st.session_state['seg']
162
  unique_colors = np.unique(real_seg.reshape(-1, real_seg.shape[2]), axis=0)
163
  unique_colors = [tuple(color) for color in unique_colors]
164
  st.session_state['unique_colors'] = unique_colors
165
 
166
  chosen_colors = st.multiselect(
167
+ label="Choose colors",
168
+ options=st.session_state['unique_colors'],
169
+ default=None,
170
+ key='unique_colors',
171
+ format_func=map_colors_rgb
172
  )
173
 
174
  if st.button("generate image", key='generate_button'):