Improve interface for better visual comparison
Browse files- Added dual output: full 4x resolution and resized for comparison
- Resized output matches input image size for easier side-by-side comparison
- Updated descriptions to explain the two outputs
- Helps users better evaluate super-resolution quality improvements
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -723,12 +723,24 @@ def upscale_image(image):
|
|
| 723 |
|
| 724 |
|
| 725 |
# Gradio interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 726 |
iface = gr.Interface(
|
| 727 |
-
fn=
|
| 728 |
inputs=gr.Image(type="pil", label="Input Satellite Image"),
|
| 729 |
-
outputs=
|
|
|
|
|
|
|
|
|
|
| 730 |
title="HAT Super-Resolution for Satellite Images",
|
| 731 |
-
description="Upload a satellite image to enhance its resolution by 4x using a fine-tuned HAT model.
|
| 732 |
examples=None,
|
| 733 |
cache_examples=False
|
| 734 |
)
|
|
|
|
| 723 |
|
| 724 |
|
| 725 |
# Gradio interface
|
| 726 |
+
def upscale_and_resize_for_display(image):
|
| 727 |
+
# Get the super-resolution output
|
| 728 |
+
upscaled = upscale_image(image)
|
| 729 |
+
|
| 730 |
+
# Resize the upscaled image to match input size for display comparison
|
| 731 |
+
display_upscaled = upscaled.resize(image.size, Image.LANCZOS)
|
| 732 |
+
|
| 733 |
+
return upscaled, display_upscaled
|
| 734 |
+
|
| 735 |
iface = gr.Interface(
|
| 736 |
+
fn=upscale_and_resize_for_display,
|
| 737 |
inputs=gr.Image(type="pil", label="Input Satellite Image"),
|
| 738 |
+
outputs=[
|
| 739 |
+
gr.Image(type="pil", label="Super-Resolution Output (4x) - Full Size"),
|
| 740 |
+
gr.Image(type="pil", label="Super-Resolution Output (4x) - Resized for Comparison")
|
| 741 |
+
],
|
| 742 |
title="HAT Super-Resolution for Satellite Images",
|
| 743 |
+
description="Upload a satellite image to enhance its resolution by 4x using a fine-tuned HAT model. The first output shows the full 4x resolution, while the second output is resized to match the input for easy visual comparison of quality improvements.",
|
| 744 |
examples=None,
|
| 745 |
cache_examples=False
|
| 746 |
)
|