Update app.py
Browse files
app.py
CHANGED
|
@@ -159,77 +159,22 @@ def generate_presigned_url(object_url):
|
|
| 159 |
|
| 160 |
|
| 161 |
with gr.Blocks() as demo:
|
| 162 |
-
gr.
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 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(
|
| 191 |
-
display_image,
|
| 192 |
-
inputs=[uploaded_image, image_url_input],
|
| 193 |
-
outputs=output_display
|
| 194 |
-
)
|
| 195 |
-
|
| 196 |
-
# Update the garment image when the URL changes
|
| 197 |
image_url_input.change(
|
| 198 |
load_image_from_url,
|
| 199 |
inputs=image_url_input,
|
| 200 |
outputs=input_garment_image
|
| 201 |
)
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 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 |
-
"""
|
| 230 |
-
|
| 231 |
-
# Attach the custom CSS
|
| 232 |
-
demo.css = custom_css
|
| 233 |
-
|
| 234 |
|
| 235 |
demo.launch(share=True)
|
|
|
|
| 159 |
|
| 160 |
|
| 161 |
with gr.Blocks() as demo:
|
| 162 |
+
with gr.Row():
|
| 163 |
+
image_url_input = gr.Textbox(label="Image URL", placeholder="Enter image URL here")
|
| 164 |
+
input_garment_image = gr.Image(label="Garment Image", type="pil", width="384px", height = "512px")
|
| 165 |
+
uploaded_image = gr.Image(label="Upload or Capture Image", type="pil", width="384px", height="512px")
|
| 166 |
+
output_display = gr.Image(label="Displayed Image or URL Result", width="384px", height="512px")
|
| 167 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
image_url_input.change(
|
| 169 |
load_image_from_url,
|
| 170 |
inputs=image_url_input,
|
| 171 |
outputs=input_garment_image
|
| 172 |
)
|
| 173 |
+
submit_btn = gr.Button("Submit")
|
| 174 |
+
submit_btn.click(
|
| 175 |
+
display_image,
|
| 176 |
+
inputs=[uploaded_image, image_url_input],
|
| 177 |
+
outputs=output_display
|
| 178 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
demo.launch(share=True)
|