BertChristiaens
commited on
Commit
•
c53fc43
1
Parent(s):
b054e3b
renaming
Browse files
app.py
CHANGED
@@ -106,12 +106,12 @@ def make_prompt_row():
|
|
106 |
def make_sidebar():
|
107 |
with st.sidebar:
|
108 |
input_image = st.file_uploader("", type=["png", "jpg"], key='input_image', on_change=on_upload)
|
109 |
-
generation_mode = st.selectbox("Generation mode", ["
|
110 |
-
"Segmentation
|
111 |
"Inpainting"], on_change=on_change_radio)
|
112 |
|
113 |
|
114 |
-
if generation_mode == "Segmentation
|
115 |
paint_mode = st.sidebar.selectbox("Painting mode", ("freedraw", "polygon"))
|
116 |
if paint_mode == "freedraw":
|
117 |
brush = st.slider("Stroke width", 5, 140, 100, key='slider_seg')
|
@@ -127,7 +127,7 @@ def make_sidebar():
|
|
127 |
"Choose a color", chosen_colors, index=0, format_func=map_colors, key='color_chooser'
|
128 |
)
|
129 |
|
130 |
-
elif generation_mode == "
|
131 |
color_chooser = "rgba(0, 0, 0, 0.0)"
|
132 |
paint_mode = 'freedraw'
|
133 |
brush = 0
|
@@ -167,7 +167,7 @@ def make_editing_canvas(canvas_color, brush, _reset_state, generation_mode, pain
|
|
167 |
brush=brush,
|
168 |
_reset_state=_reset_state
|
169 |
)
|
170 |
-
if generation_mode == "Segmentation
|
171 |
canvas = st_canvas(
|
172 |
**canvas_dict,
|
173 |
)
|
@@ -192,7 +192,7 @@ def make_editing_canvas(canvas_color, brush, _reset_state, generation_mode, pain
|
|
192 |
st.session_state['output_image'] = result_image
|
193 |
|
194 |
|
195 |
-
elif generation_mode == "
|
196 |
canvas = st_canvas(
|
197 |
**canvas_dict,
|
198 |
)
|
@@ -281,7 +281,7 @@ def main():
|
|
281 |
st.write("Welcome to the interior design controlnet demo! "
|
282 |
"You can start by uploading a picture of your room, after which you will see "
|
283 |
"a good variety of options to edit your current room to generate the room of your dreams! "
|
284 |
-
"You can choose between inpainting,
|
285 |
"use our custom trained controlnet model."
|
286 |
)
|
287 |
with st.expander("Useful information", expanded=True):
|
@@ -363,9 +363,9 @@ def main():
|
|
363 |
|
364 |
if generation_mode == "Inpainting":
|
365 |
make_inpainting_explanation()
|
366 |
-
elif generation_mode == "Segmentation
|
367 |
make_segmentation_explanation()
|
368 |
-
elif generation_mode == "
|
369 |
make_regeneration_explanation()
|
370 |
|
371 |
col1, col2 = st.columns(2)
|
|
|
106 |
def make_sidebar():
|
107 |
with st.sidebar:
|
108 |
input_image = st.file_uploader("", type=["png", "jpg"], key='input_image', on_change=on_upload)
|
109 |
+
generation_mode = st.selectbox("Generation mode", ["Regenerate",
|
110 |
+
"Segmentation",
|
111 |
"Inpainting"], on_change=on_change_radio)
|
112 |
|
113 |
|
114 |
+
if generation_mode == "Segmentation":
|
115 |
paint_mode = st.sidebar.selectbox("Painting mode", ("freedraw", "polygon"))
|
116 |
if paint_mode == "freedraw":
|
117 |
brush = st.slider("Stroke width", 5, 140, 100, key='slider_seg')
|
|
|
127 |
"Choose a color", chosen_colors, index=0, format_func=map_colors, key='color_chooser'
|
128 |
)
|
129 |
|
130 |
+
elif generation_mode == "Regenerate":
|
131 |
color_chooser = "rgba(0, 0, 0, 0.0)"
|
132 |
paint_mode = 'freedraw'
|
133 |
brush = 0
|
|
|
167 |
brush=brush,
|
168 |
_reset_state=_reset_state
|
169 |
)
|
170 |
+
if generation_mode == "Segmentation":
|
171 |
canvas = st_canvas(
|
172 |
**canvas_dict,
|
173 |
)
|
|
|
192 |
st.session_state['output_image'] = result_image
|
193 |
|
194 |
|
195 |
+
elif generation_mode == "Regenerate":
|
196 |
canvas = st_canvas(
|
197 |
**canvas_dict,
|
198 |
)
|
|
|
281 |
st.write("Welcome to the interior design controlnet demo! "
|
282 |
"You can start by uploading a picture of your room, after which you will see "
|
283 |
"a good variety of options to edit your current room to generate the room of your dreams! "
|
284 |
+
"You can choose between inpainting, Segmentation and re-generating objects, which "
|
285 |
"use our custom trained controlnet model."
|
286 |
)
|
287 |
with st.expander("Useful information", expanded=True):
|
|
|
363 |
|
364 |
if generation_mode == "Inpainting":
|
365 |
make_inpainting_explanation()
|
366 |
+
elif generation_mode == "Segmentation":
|
367 |
make_segmentation_explanation()
|
368 |
+
elif generation_mode == "Regenerate":
|
369 |
make_regeneration_explanation()
|
370 |
|
371 |
col1, col2 = st.columns(2)
|