Simplify interface to single output with exact size matching
Browse files- Removed dual outputs, now shows only one enhanced image
- Output image resized to exactly match input dimensions for comparison
- Simplified layout with side-by-side input and output
- Updated CSS to ensure identical display sizes
- Cleaner user experience focused on quality comparison
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -730,36 +730,34 @@ def upscale_and_resize_for_display(image):
|
|
| 730 |
# Resize the upscaled image to match input size for display comparison
|
| 731 |
display_upscaled = upscaled.resize(image.size, Image.LANCZOS)
|
| 732 |
|
| 733 |
-
return
|
| 734 |
|
| 735 |
-
# Custom CSS to ensure images display at same size
|
| 736 |
css = """
|
| 737 |
.image-container img {
|
| 738 |
max-width: 100% !important;
|
| 739 |
-
|
| 740 |
object-fit: contain !important;
|
| 741 |
}
|
| 742 |
"""
|
| 743 |
|
| 744 |
with gr.Blocks(css=css, title="HAT Super-Resolution for Satellite Images") as iface:
|
| 745 |
gr.Markdown("# HAT Super-Resolution for Satellite Images")
|
| 746 |
-
gr.Markdown("Upload a satellite image to enhance its resolution by 4x using a fine-tuned HAT model.
|
| 747 |
|
| 748 |
with gr.Row():
|
| 749 |
with gr.Column():
|
| 750 |
input_image = gr.Image(type="pil", label="Input Satellite Image", elem_classes=["image-container"])
|
| 751 |
-
submit_btn = gr.Button("Enhance Image", variant="primary")
|
| 752 |
|
| 753 |
with gr.Column():
|
| 754 |
-
|
| 755 |
|
| 756 |
-
|
| 757 |
-
full_output = gr.Image(type="pil", label="Full Resolution Output (4x)")
|
| 758 |
|
| 759 |
submit_btn.click(
|
| 760 |
fn=upscale_and_resize_for_display,
|
| 761 |
inputs=input_image,
|
| 762 |
-
outputs=
|
| 763 |
)
|
| 764 |
|
| 765 |
if __name__ == "__main__":
|
|
|
|
| 730 |
# Resize the upscaled image to match input size for display comparison
|
| 731 |
display_upscaled = upscaled.resize(image.size, Image.LANCZOS)
|
| 732 |
|
| 733 |
+
return display_upscaled
|
| 734 |
|
| 735 |
+
# Custom CSS to ensure images display at exactly the same size
|
| 736 |
css = """
|
| 737 |
.image-container img {
|
| 738 |
max-width: 100% !important;
|
| 739 |
+
height: auto !important;
|
| 740 |
object-fit: contain !important;
|
| 741 |
}
|
| 742 |
"""
|
| 743 |
|
| 744 |
with gr.Blocks(css=css, title="HAT Super-Resolution for Satellite Images") as iface:
|
| 745 |
gr.Markdown("# HAT Super-Resolution for Satellite Images")
|
| 746 |
+
gr.Markdown("Upload a satellite image to enhance its resolution by 4x using a fine-tuned HAT model. The output is resized to match the input size for easy comparison of quality improvements.")
|
| 747 |
|
| 748 |
with gr.Row():
|
| 749 |
with gr.Column():
|
| 750 |
input_image = gr.Image(type="pil", label="Input Satellite Image", elem_classes=["image-container"])
|
|
|
|
| 751 |
|
| 752 |
with gr.Column():
|
| 753 |
+
output_image = gr.Image(type="pil", label="Enhanced Output (4x Super-Resolution)", elem_classes=["image-container"])
|
| 754 |
|
| 755 |
+
submit_btn = gr.Button("Enhance Image", variant="primary")
|
|
|
|
| 756 |
|
| 757 |
submit_btn.click(
|
| 758 |
fn=upscale_and_resize_for_display,
|
| 759 |
inputs=input_image,
|
| 760 |
+
outputs=output_image
|
| 761 |
)
|
| 762 |
|
| 763 |
if __name__ == "__main__":
|