Spaces:
Running
Running
BertChristiaens
commited on
Commit
•
f8c7d9d
1
Parent(s):
e74357b
map colors
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ if not EMULATED:
|
|
16 |
else:
|
17 |
from models_stub import make_image_controlnet, make_inpainting, segment_image
|
18 |
|
19 |
-
from config import HEIGHT, WIDTH, POS_PROMPT, NEG_PROMPT, COLOR_MAPPING, map_colors
|
20 |
from palette import COLOR_MAPPING_CATEGORY
|
21 |
from preprocessing import preprocess_seg_mask, get_image, get_mask
|
22 |
|
@@ -166,7 +166,7 @@ def make_editing_canvas(canvas_color, brush, _reset_state, generation_mode, pain
|
|
166 |
st.session_state['unique_colors'] = unique_colors
|
167 |
# multiselect to choose multiple colors
|
168 |
chosen_colors = st.multiselect(
|
169 |
-
label="Choose colors", options=unique_colors, default=None, key='unique_colors'
|
170 |
)
|
171 |
print(chosen_colors)
|
172 |
|
|
|
16 |
else:
|
17 |
from models_stub import make_image_controlnet, make_inpainting, segment_image
|
18 |
|
19 |
+
from config import HEIGHT, WIDTH, POS_PROMPT, NEG_PROMPT, COLOR_MAPPING, map_colors, map_colors_rgb
|
20 |
from palette import COLOR_MAPPING_CATEGORY
|
21 |
from preprocessing import preprocess_seg_mask, get_image, get_mask
|
22 |
|
|
|
166 |
st.session_state['unique_colors'] = unique_colors
|
167 |
# multiselect to choose multiple colors
|
168 |
chosen_colors = st.multiselect(
|
169 |
+
label="Choose colors", options=unique_colors, default=None, key='unique_colors', format_func=map_colors_rgb
|
170 |
)
|
171 |
print(chosen_colors)
|
172 |
|
config.py
CHANGED
@@ -27,6 +27,9 @@ def map_colors(color: str) -> str:
|
|
27 |
"""
|
28 |
return COLOR_MAPPING[color]
|
29 |
|
|
|
|
|
|
|
30 |
|
31 |
POS_PROMPT = "tree, sky, cloud, scenery, outdoors, grass, flowers, sunlight, beautiful, ultra detailed beautiful landscape, architectural renderings vegetation, high res, best high quality landscape, outdoor lighting, sunshine, 4k, 8k, realistic"
|
32 |
NEG_PROMPT= "lowres, deformed, blurry, bad anatomy, disfigured, poorly drawn face, mutation, mutated, extra limb, ugly, poorly drawn hands, missing limb, blurry, floating limbs, disconnected limbs, malformed hands, blur, out of focus, long neck, long body, mutated hands and fingers, out of frame"
|
|
|
27 |
"""
|
28 |
return COLOR_MAPPING[color]
|
29 |
|
30 |
+
def map_colors_rgb(color: tuple) -> str:
|
31 |
+
return COLOR_MAPPING_RGB[color]
|
32 |
+
|
33 |
|
34 |
POS_PROMPT = "tree, sky, cloud, scenery, outdoors, grass, flowers, sunlight, beautiful, ultra detailed beautiful landscape, architectural renderings vegetation, high res, best high quality landscape, outdoor lighting, sunshine, 4k, 8k, realistic"
|
35 |
NEG_PROMPT= "lowres, deformed, blurry, bad anatomy, disfigured, poorly drawn face, mutation, mutated, extra limb, ugly, poorly drawn hands, missing limb, blurry, floating limbs, disconnected limbs, malformed hands, blur, out of focus, long neck, long body, mutated hands and fingers, out of frame"
|