Update app.py
Browse files
app.py
CHANGED
|
@@ -161,32 +161,30 @@ def generate_presigned_url(object_url):
|
|
| 161 |
with gr.Blocks() as demo:
|
| 162 |
gr.Markdown("## Virtual Try-On")
|
| 163 |
|
| 164 |
-
#
|
| 165 |
with gr.Row(elem_id="responsive-container"):
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
elem_id="output-image"
|
| 189 |
-
)
|
| 190 |
|
| 191 |
submit_btn = gr.Button("Submit", elem_id="submit-btn")
|
| 192 |
submit_btn.click(
|
|
@@ -202,20 +200,30 @@ with gr.Blocks() as demo:
|
|
| 202 |
outputs=input_garment_image
|
| 203 |
)
|
| 204 |
|
| 205 |
-
# Custom CSS for responsiveness
|
| 206 |
custom_css = """
|
|
|
|
| 207 |
#responsive-container {
|
| 208 |
-
|
|
|
|
|
|
|
| 209 |
justify-content: center;
|
|
|
|
| 210 |
}
|
| 211 |
-
#responsive-container .gr-
|
| 212 |
-
flex: 1
|
| 213 |
-
max-width:
|
| 214 |
}
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
}
|
| 220 |
}
|
| 221 |
"""
|
|
|
|
| 161 |
with gr.Blocks() as demo:
|
| 162 |
gr.Markdown("## Virtual Try-On")
|
| 163 |
|
| 164 |
+
# Fixed layout for desktop, responsive only for mobile
|
| 165 |
with gr.Row(elem_id="responsive-container"):
|
| 166 |
+
image_url_input = gr.Textbox(
|
| 167 |
+
label="Image URL",
|
| 168 |
+
placeholder="Enter image URL here",
|
| 169 |
+
interactive=True,
|
| 170 |
+
elem_id="url-input"
|
| 171 |
+
)
|
| 172 |
+
input_garment_image = gr.Image(
|
| 173 |
+
label="Garment Image",
|
| 174 |
+
type="pil",
|
| 175 |
+
interactive=True,
|
| 176 |
+
elem_id="garment-image"
|
| 177 |
+
)
|
| 178 |
+
uploaded_image = gr.Image(
|
| 179 |
+
label="Upload or Capture Image",
|
| 180 |
+
type="pil",
|
| 181 |
+
interactive=True,
|
| 182 |
+
elem_id="uploaded-image"
|
| 183 |
+
)
|
| 184 |
+
output_display = gr.Image(
|
| 185 |
+
label="Displayed Image or URL Result",
|
| 186 |
+
elem_id="output-image"
|
| 187 |
+
)
|
|
|
|
|
|
|
| 188 |
|
| 189 |
submit_btn = gr.Button("Submit", elem_id="submit-btn")
|
| 190 |
submit_btn.click(
|
|
|
|
| 200 |
outputs=input_garment_image
|
| 201 |
)
|
| 202 |
|
| 203 |
+
# Custom CSS for mobile responsiveness
|
| 204 |
custom_css = """
|
| 205 |
+
/* Default layout for PC screens */
|
| 206 |
#responsive-container {
|
| 207 |
+
display: flex;
|
| 208 |
+
flex-direction: row;
|
| 209 |
+
gap: 20px;
|
| 210 |
justify-content: center;
|
| 211 |
+
align-items: center;
|
| 212 |
}
|
| 213 |
+
#responsive-container .gr-box {
|
| 214 |
+
flex: 1;
|
| 215 |
+
max-width: 384px;
|
| 216 |
}
|
| 217 |
+
|
| 218 |
+
/* Responsive layout for mobile screens */
|
| 219 |
+
@media (max-width: 768px) {
|
| 220 |
+
#responsive-container {
|
| 221 |
+
flex-wrap: wrap;
|
| 222 |
+
flex-direction: column;
|
| 223 |
+
}
|
| 224 |
+
#responsive-container .gr-box {
|
| 225 |
+
flex: 1 1 100%;
|
| 226 |
+
max-width: 100%;
|
| 227 |
}
|
| 228 |
}
|
| 229 |
"""
|