Fix layout issue
Browse files
app.py
CHANGED
|
@@ -732,21 +732,18 @@ def upscale_and_resize_for_display(image):
|
|
| 732 |
|
| 733 |
return display_upscaled
|
| 734 |
|
| 735 |
-
# Custom CSS to
|
| 736 |
css = """
|
| 737 |
-
|
| 738 |
-
|
| 739 |
-
|
| 740 |
-
|
| 741 |
-
min-height: 400px !important;
|
| 742 |
-
max-height: 500px !important;
|
| 743 |
-
width: 100% !important;
|
| 744 |
}
|
|
|
|
|
|
|
| 745 |
.image-container img {
|
| 746 |
-
|
| 747 |
-
|
| 748 |
-
width: auto !important;
|
| 749 |
-
height: auto !important;
|
| 750 |
object-fit: contain !important;
|
| 751 |
object-position: center !important;
|
| 752 |
}
|
|
@@ -762,7 +759,10 @@ with gr.Blocks(css=css, title="HAT Super-Resolution for Satellite Images") as if
|
|
| 762 |
type="pil",
|
| 763 |
label="Input Satellite Image",
|
| 764 |
elem_classes="image-container",
|
| 765 |
-
sources=["upload"]
|
|
|
|
|
|
|
|
|
|
| 766 |
)
|
| 767 |
|
| 768 |
with gr.Column():
|
|
@@ -770,7 +770,10 @@ with gr.Blocks(css=css, title="HAT Super-Resolution for Satellite Images") as if
|
|
| 770 |
type="pil",
|
| 771 |
label="Enhanced Output (4x Super-Resolution)",
|
| 772 |
elem_classes="image-container",
|
| 773 |
-
interactive=False
|
|
|
|
|
|
|
|
|
|
| 774 |
)
|
| 775 |
|
| 776 |
submit_btn = gr.Button("Enhance Image", variant="primary")
|
|
|
|
| 732 |
|
| 733 |
return display_upscaled
|
| 734 |
|
| 735 |
+
# Custom CSS to make images fill containers while preserving aspect ratio
|
| 736 |
css = """
|
| 737 |
+
/* Target only the image display area, not the whole component */
|
| 738 |
+
.image-container [data-testid="image"] {
|
| 739 |
+
height: 500px !important;
|
| 740 |
+
min-height: 500px !important;
|
|
|
|
|
|
|
|
|
|
| 741 |
}
|
| 742 |
+
|
| 743 |
+
/* Make images fill their containers */
|
| 744 |
.image-container img {
|
| 745 |
+
width: 500px !important;
|
| 746 |
+
height: 500px !important;
|
|
|
|
|
|
|
| 747 |
object-fit: contain !important;
|
| 748 |
object-position: center !important;
|
| 749 |
}
|
|
|
|
| 759 |
type="pil",
|
| 760 |
label="Input Satellite Image",
|
| 761 |
elem_classes="image-container",
|
| 762 |
+
sources=["upload"],
|
| 763 |
+
height=500,
|
| 764 |
+
width=500,
|
| 765 |
+
show_download_button=False
|
| 766 |
)
|
| 767 |
|
| 768 |
with gr.Column():
|
|
|
|
| 770 |
type="pil",
|
| 771 |
label="Enhanced Output (4x Super-Resolution)",
|
| 772 |
elem_classes="image-container",
|
| 773 |
+
interactive=False,
|
| 774 |
+
height=500,
|
| 775 |
+
width=500,
|
| 776 |
+
show_download_button=False
|
| 777 |
)
|
| 778 |
|
| 779 |
submit_btn = gr.Button("Enhance Image", variant="primary")
|