Spaces:
Sleeping
Sleeping
Handle the case where "bedroom1" is not an exact match but is still a bedroom.
Browse files
app.py
CHANGED
@@ -45,7 +45,6 @@ def creativity(intensity):
|
|
45 |
|
46 |
housegan_labels = {"living_room": 1, "kitchen": 2, "bedroom": 3, "bathroom": 4, "missing": 5, "closet": 6,
|
47 |
"balcony": 7, "corridor": 8, "dining_room": 9, "laundry_room": 10}
|
48 |
-
default_color = [255, 255, 255]
|
49 |
architext_colors = [[0, 0, 0], [249, 222, 182], [195, 209, 217], [250, 120, 128], [126, 202, 234], [190, 0, 198], [255, 255, 255],
|
50 |
[6, 53, 17], [17, 33, 58], [132, 151, 246], [197, 203, 159], [6, 53, 17],]
|
51 |
|
@@ -118,7 +117,12 @@ def prompt_to_layout(user_prompt, intensity, fpath=None):
|
|
118 |
for poly in polygons:
|
119 |
scaled_poly = scale(Polygon(np.array(poly, dtype=int)), xfact=2, yfact=2, origin=(0,0))
|
120 |
geom.append(scaled_poly)
|
121 |
-
colors = [
|
|
|
|
|
|
|
|
|
|
|
122 |
_, im = draw_polygons(geom, colors, fpath=fpath)
|
123 |
html = '<img class="labels" src="images/labels.png" />'
|
124 |
legend = Image.open("labels.png")
|
|
|
45 |
|
46 |
housegan_labels = {"living_room": 1, "kitchen": 2, "bedroom": 3, "bathroom": 4, "missing": 5, "closet": 6,
|
47 |
"balcony": 7, "corridor": 8, "dining_room": 9, "laundry_room": 10}
|
|
|
48 |
architext_colors = [[0, 0, 0], [249, 222, 182], [195, 209, 217], [250, 120, 128], [126, 202, 234], [190, 0, 198], [255, 255, 255],
|
49 |
[6, 53, 17], [17, 33, 58], [132, 151, 246], [197, 203, 159], [6, 53, 17],]
|
50 |
|
|
|
117 |
for poly in polygons:
|
118 |
scaled_poly = scale(Polygon(np.array(poly, dtype=int)), xfact=2, yfact=2, origin=(0,0))
|
119 |
geom.append(scaled_poly)
|
120 |
+
colors = []
|
121 |
+
for space in spaces:
|
122 |
+
for key in housegan_labels.keys():
|
123 |
+
if key in space:
|
124 |
+
colors.append(architext_colors[housegan_labels[key]])
|
125 |
+
break
|
126 |
_, im = draw_polygons(geom, colors, fpath=fpath)
|
127 |
html = '<img class="labels" src="images/labels.png" />'
|
128 |
legend = Image.open("labels.png")
|