Spaces:
Runtime error
Runtime error
Commit
·
f97637f
1
Parent(s):
45dc043
generate 3 outputs
Browse files
app.py
CHANGED
@@ -13,9 +13,9 @@ def predict(image, style, backyard_style, color_preference, additional_info):
|
|
13 |
|
14 |
output_images, transparent_mask_image = vs_tool.virtual_stage(
|
15 |
image=init_image, style=style, color_preference=color_preference,
|
16 |
-
additional_info=additional_info, number_images=
|
17 |
|
18 |
-
return output_images[0], transparent_mask_image
|
19 |
|
20 |
|
21 |
image_blocks = gr.Blocks()
|
@@ -65,9 +65,12 @@ with image_blocks as demo:
|
|
65 |
)
|
66 |
with gr.Column():
|
67 |
mask_image = gr.Image(label="Mask image", elem_id="mask-img", type="pil").style(height=500)
|
68 |
-
|
|
|
|
|
69 |
|
70 |
-
|
|
|
71 |
|
72 |
gr.Markdown("## Image Examples")
|
73 |
gr.Examples(
|
|
|
13 |
|
14 |
output_images, transparent_mask_image = vs_tool.virtual_stage(
|
15 |
image=init_image, style=style, color_preference=color_preference,
|
16 |
+
additional_info=additional_info, number_images=3)
|
17 |
|
18 |
+
return output_images[0], output_images[1], output_images[2], transparent_mask_image
|
19 |
|
20 |
|
21 |
image_blocks = gr.Blocks()
|
|
|
65 |
)
|
66 |
with gr.Column():
|
67 |
mask_image = gr.Image(label="Mask image", elem_id="mask-img", type="pil").style(height=500)
|
68 |
+
image_out_1 = gr.Image(label="Output 1", elem_id="output-img-1", type="pil").style(height=512)
|
69 |
+
image_out_2 = gr.Image(label="Output 2", elem_id="output-img-2", type="pil").style(height=512)
|
70 |
+
image_out_3 = gr.Image(label="Output 3", elem_id="output-img-3", type="pil").style(height=512)
|
71 |
|
72 |
+
btn.click(fn=predict, inputs=[image, style, backyard_style, color_preference, additional_info],
|
73 |
+
outputs=[image_out_1, image_out_2, image_out_3, mask_image])
|
74 |
|
75 |
gr.Markdown("## Image Examples")
|
76 |
gr.Examples(
|
model.py
CHANGED
@@ -93,6 +93,7 @@ class VirtualStagingToolV2():
|
|
93 |
elif 7 in label_ids:
|
94 |
room = 'bedroom'
|
95 |
elif 23 in label_ids or 49 in label_ids:
|
|
|
96 |
room = 'living room'
|
97 |
elif 15 in label_ids and 19 in label_ids:
|
98 |
room = 'dining room'
|
@@ -135,7 +136,7 @@ class VirtualStagingToolV2():
|
|
135 |
i in ['shower', 'bathtub', 'chest of drawers', 'counter', 'countertop', 'sink']]
|
136 |
elif room == 'living room':
|
137 |
items = [i for i in items if
|
138 |
-
i in ['table', 'sofa', 'chest of drawers', 'armchair', 'cabinet', '
|
139 |
elif room == 'dining room':
|
140 |
items = [i for i in items if i in ['table', 'chair', 'cabinet']]
|
141 |
|
|
|
93 |
elif 7 in label_ids:
|
94 |
room = 'bedroom'
|
95 |
elif 23 in label_ids or 49 in label_ids:
|
96 |
+
mask_items = [0, 3, 5, 8, 14, 49]
|
97 |
room = 'living room'
|
98 |
elif 15 in label_ids and 19 in label_ids:
|
99 |
room = 'dining room'
|
|
|
136 |
i in ['shower', 'bathtub', 'chest of drawers', 'counter', 'countertop', 'sink']]
|
137 |
elif room == 'living room':
|
138 |
items = [i for i in items if
|
139 |
+
i in ['table', 'sofa', 'chest of drawers', 'armchair', 'cabinet', 'coffee table']]
|
140 |
elif room == 'dining room':
|
141 |
items = [i for i in items if i in ['table', 'chair', 'cabinet']]
|
142 |
|