Spaces:
Running
Running
Commit
·
a83dfee
1
Parent(s):
e1b10c7
feat: swap left and right columns
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ def find_optimal_latent(image_idx: int) -> tuple[Image.Image, tuple[int, int], I
|
|
48 |
with gr.Blocks(
|
49 |
css="""
|
50 |
.container {
|
51 |
-
max-width:
|
52 |
width: 100% !important;
|
53 |
margin-left: auto !important;
|
54 |
margin-right: auto !important;
|
@@ -68,15 +68,13 @@ with gr.Blocks(
|
|
68 |
.radio-container {
|
69 |
width: 100% !important;
|
70 |
max-width: 450px !important;
|
71 |
-
margin-
|
72 |
-
margin-right: auto !important;
|
73 |
}
|
74 |
.image-container {
|
75 |
width: 100% !important;
|
76 |
aspect-ratio: 1 !important;
|
77 |
max-width: 450px !important;
|
78 |
-
margin-
|
79 |
-
margin-right: auto !important;
|
80 |
}
|
81 |
.image-container img {
|
82 |
width: 100% !important;
|
@@ -87,9 +85,8 @@ with gr.Blocks(
|
|
87 |
width: 100% !important;
|
88 |
aspect-ratio: 1 !important;
|
89 |
position: relative !important;
|
90 |
-
max-width:
|
91 |
-
margin-
|
92 |
-
margin-right: auto !important;
|
93 |
}
|
94 |
.coordinate-container img {
|
95 |
width: 100% !important;
|
@@ -97,12 +94,11 @@ with gr.Blocks(
|
|
97 |
object-fit: contain !important;
|
98 |
}
|
99 |
.button-container {
|
|
|
|
|
100 |
display: flex !important;
|
101 |
justify-content: center !important;
|
102 |
-
|
103 |
-
max-width: 600px !important;
|
104 |
-
margin-left: auto !important;
|
105 |
-
margin-right: auto !important;
|
106 |
}
|
107 |
.documentation {
|
108 |
margin-top: 2rem !important;
|
@@ -111,8 +107,6 @@ with gr.Blocks(
|
|
111 |
border-radius: 8px !important;
|
112 |
}
|
113 |
.optimal-button {
|
114 |
-
margin-top: 1rem !important;
|
115 |
-
margin-bottom: 1rem !important;
|
116 |
width: 200px !important;
|
117 |
}
|
118 |
"""
|
@@ -150,7 +144,8 @@ with gr.Blocks(
|
|
150 |
)
|
151 |
|
152 |
with gr.Row():
|
153 |
-
|
|
|
154 |
selected_idx = gr.State(value=0)
|
155 |
coords = gr.State()
|
156 |
|
@@ -162,26 +157,6 @@ with gr.Blocks(
|
|
162 |
interactive=True,
|
163 |
)
|
164 |
|
165 |
-
gr.Markdown("### Reference Pattern")
|
166 |
-
with gr.Column(elem_classes="image-container"):
|
167 |
-
reference_image = gr.Image(
|
168 |
-
value="imgs/pattern_0.png",
|
169 |
-
show_label=False,
|
170 |
-
interactive=False,
|
171 |
-
show_download_button=False,
|
172 |
-
show_fullscreen_button=False,
|
173 |
-
)
|
174 |
-
|
175 |
-
gr.Markdown("### Generated Output")
|
176 |
-
with gr.Column(elem_classes="image-container"):
|
177 |
-
output_image = gr.Image(
|
178 |
-
show_label=False,
|
179 |
-
interactive=False,
|
180 |
-
show_download_button=False,
|
181 |
-
show_fullscreen_button=False,
|
182 |
-
)
|
183 |
-
|
184 |
-
with gr.Column(scale=4):
|
185 |
gr.Markdown("### Coordinate Selector")
|
186 |
gr.Markdown(
|
187 |
"Click anywhere in the image below to select (x, y) coordinates in the latent space"
|
@@ -201,6 +176,27 @@ with gr.Blocks(
|
|
201 |
with gr.Column(elem_classes="button-container"):
|
202 |
optimal_button = gr.Button("Find Optimal Latent", elem_classes="optimal-button")
|
203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
with gr.Column(elem_classes="documentation"):
|
205 |
gr.Markdown(
|
206 |
"""
|
|
|
48 |
with gr.Blocks(
|
49 |
css="""
|
50 |
.container {
|
51 |
+
max-width: 1200px !important;
|
52 |
width: 100% !important;
|
53 |
margin-left: auto !important;
|
54 |
margin-right: auto !important;
|
|
|
68 |
.radio-container {
|
69 |
width: 100% !important;
|
70 |
max-width: 450px !important;
|
71 |
+
margin-bottom: 1rem !important;
|
|
|
72 |
}
|
73 |
.image-container {
|
74 |
width: 100% !important;
|
75 |
aspect-ratio: 1 !important;
|
76 |
max-width: 450px !important;
|
77 |
+
margin-bottom: 1rem !important;
|
|
|
78 |
}
|
79 |
.image-container img {
|
80 |
width: 100% !important;
|
|
|
85 |
width: 100% !important;
|
86 |
aspect-ratio: 1 !important;
|
87 |
position: relative !important;
|
88 |
+
max-width: 450px !important;
|
89 |
+
margin-bottom: 1rem !important;
|
|
|
90 |
}
|
91 |
.coordinate-container img {
|
92 |
width: 100% !important;
|
|
|
94 |
object-fit: contain !important;
|
95 |
}
|
96 |
.button-container {
|
97 |
+
width: 100% !important;
|
98 |
+
max-width: 450px !important;
|
99 |
display: flex !important;
|
100 |
justify-content: center !important;
|
101 |
+
margin-bottom: 1rem !important;
|
|
|
|
|
|
|
102 |
}
|
103 |
.documentation {
|
104 |
margin-top: 2rem !important;
|
|
|
107 |
border-radius: 8px !important;
|
108 |
}
|
109 |
.optimal-button {
|
|
|
|
|
110 |
width: 200px !important;
|
111 |
}
|
112 |
"""
|
|
|
144 |
)
|
145 |
|
146 |
with gr.Row():
|
147 |
+
# Left column for controls
|
148 |
+
with gr.Column(scale=1):
|
149 |
selected_idx = gr.State(value=0)
|
150 |
coords = gr.State()
|
151 |
|
|
|
157 |
interactive=True,
|
158 |
)
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
gr.Markdown("### Coordinate Selector")
|
161 |
gr.Markdown(
|
162 |
"Click anywhere in the image below to select (x, y) coordinates in the latent space"
|
|
|
176 |
with gr.Column(elem_classes="button-container"):
|
177 |
optimal_button = gr.Button("Find Optimal Latent", elem_classes="optimal-button")
|
178 |
|
179 |
+
# Right column for images
|
180 |
+
with gr.Column(scale=1):
|
181 |
+
gr.Markdown("### Reference Pattern")
|
182 |
+
with gr.Column(elem_classes="image-container"):
|
183 |
+
reference_image = gr.Image(
|
184 |
+
value="imgs/pattern_0.png",
|
185 |
+
show_label=False,
|
186 |
+
interactive=False,
|
187 |
+
show_download_button=False,
|
188 |
+
show_fullscreen_button=False,
|
189 |
+
)
|
190 |
+
|
191 |
+
gr.Markdown("### Generated Output")
|
192 |
+
with gr.Column(elem_classes="image-container"):
|
193 |
+
output_image = gr.Image(
|
194 |
+
show_label=False,
|
195 |
+
interactive=False,
|
196 |
+
show_download_button=False,
|
197 |
+
show_fullscreen_button=False,
|
198 |
+
)
|
199 |
+
|
200 |
with gr.Column(elem_classes="documentation"):
|
201 |
gr.Markdown(
|
202 |
"""
|