Spaces:
Runtime error
Runtime error
fix gradio UI
Browse files
app.py
CHANGED
@@ -20,8 +20,8 @@ tokenizer = AutoTokenizer.from_pretrained('gpt2')
|
|
20 |
housegan_labels = {"living_room": 1, "kitchen": 2, "bedroom": 3, "bathroom": 4, "missing": 5, "closet": 6,
|
21 |
"balcony": 7, "corridor": 8, "dining_room": 9, "laundry_room": 10}
|
22 |
|
23 |
-
|
24 |
-
[6, 53, 17], [
|
25 |
|
26 |
regex = re.compile(".*?\((.*?)\)")
|
27 |
|
@@ -82,7 +82,7 @@ def prompt_to_layout(user_prompt, fpath=None):
|
|
82 |
for poly in polygons:
|
83 |
geom.append(Polygon(np.array(poly, dtype=int)))
|
84 |
|
85 |
-
colors = [
|
86 |
|
87 |
_, im = draw_polygons(geom, colors, fpath=fpath)
|
88 |
|
@@ -108,7 +108,7 @@ def mut_txt2layout(mut_output):
|
|
108 |
for poly in polygons:
|
109 |
geom.append(Polygon(np.array(poly, dtype=int)))
|
110 |
|
111 |
-
colors = [
|
112 |
_, im = draw_polygons(geom, colors, fpath=None)
|
113 |
|
114 |
legend = Image.open("legend.png")
|
@@ -143,7 +143,7 @@ custom_css="""
|
|
143 |
.gradio_page {
|
144 |
display: flex;
|
145 |
width: 100vw;
|
146 |
-
height: 100vh;
|
147 |
flex-direction: column;
|
148 |
justify-content: center;
|
149 |
align-items: center;
|
@@ -175,6 +175,7 @@ custom_css="""
|
|
175 |
.gradio_interface[theme=default] .panel_button.submit:hover {
|
176 |
background: #000000;
|
177 |
}
|
|
|
178 |
.input_text {
|
179 |
font: 200 50px garamond-premier-pro-display, serif;
|
180 |
line-height: 115%;
|
@@ -202,8 +203,12 @@ custom_css="""
|
|
202 |
.panel:nth-child(2) {
|
203 |
background: #D3ECF5;
|
204 |
}
|
|
|
|
|
|
|
205 |
.gradio_interface[theme=default] .component_set {
|
206 |
background: transparent;
|
|
|
207 |
}"""
|
208 |
|
209 |
def gen_and_mutate(user_prompt, mutate=False):
|
|
|
20 |
housegan_labels = {"living_room": 1, "kitchen": 2, "bedroom": 3, "bathroom": 4, "missing": 5, "closet": 6,
|
21 |
"balcony": 7, "corridor": 8, "dining_room": 9, "laundry_room": 10}
|
22 |
|
23 |
+
architext_colors = [[0, 0, 0], [249, 222, 182], [195, 209, 217], [250, 120, 128], [126, 202, 234], [190, 0, 198], [255, 255, 255],
|
24 |
+
[6, 53, 17], [17, 33, 58], [132, 151, 246], [197, 203, 159], [6, 53, 17],]
|
25 |
|
26 |
regex = re.compile(".*?\((.*?)\)")
|
27 |
|
|
|
82 |
for poly in polygons:
|
83 |
geom.append(Polygon(np.array(poly, dtype=int)))
|
84 |
|
85 |
+
colors = [architext_colors[housegan_labels[space]] for space in spaces]
|
86 |
|
87 |
_, im = draw_polygons(geom, colors, fpath=fpath)
|
88 |
|
|
|
108 |
for poly in polygons:
|
109 |
geom.append(Polygon(np.array(poly, dtype=int)))
|
110 |
|
111 |
+
colors = [architext_colors[housegan_labels[space]] for space in spaces]
|
112 |
_, im = draw_polygons(geom, colors, fpath=None)
|
113 |
|
114 |
legend = Image.open("legend.png")
|
|
|
143 |
.gradio_page {
|
144 |
display: flex;
|
145 |
width: 100vw;
|
146 |
+
min-height: 100vh;
|
147 |
flex-direction: column;
|
148 |
justify-content: center;
|
149 |
align-items: center;
|
|
|
175 |
.gradio_interface[theme=default] .panel_button.submit:hover {
|
176 |
background: #000000;
|
177 |
}
|
178 |
+
|
179 |
.input_text {
|
180 |
font: 200 50px garamond-premier-pro-display, serif;
|
181 |
line-height: 115%;
|
|
|
203 |
.panel:nth-child(2) {
|
204 |
background: #D3ECF5;
|
205 |
}
|
206 |
+
.gradio_interface[theme=default] .output_image .image_preview_holder {
|
207 |
+
background: #D3ECF5;
|
208 |
+
}
|
209 |
.gradio_interface[theme=default] .component_set {
|
210 |
background: transparent;
|
211 |
+
opacity: 1 !important;
|
212 |
}"""
|
213 |
|
214 |
def gen_and_mutate(user_prompt, mutate=False):
|