Spaces:
Running
on
Zero
Running
on
Zero
added link to project website
Browse files
app.py
CHANGED
|
@@ -9,7 +9,16 @@ import os
|
|
| 9 |
import sys
|
| 10 |
import json # Added import
|
| 11 |
import copy
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Add project root to sys.path to allow direct import of var_post_samp
|
| 14 |
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "."))
|
| 15 |
if project_root not in sys.path:
|
|
@@ -552,17 +561,34 @@ if __name__ == "__main__":
|
|
| 552 |
sys.exit(1)
|
| 553 |
|
| 554 |
# --- Define Gradio UI using gr.Blocks after globals are initialized ---
|
| 555 |
-
title_str = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 556 |
description_str = """
|
| 557 |
-
Select a task
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
Use the slider to compare the low resolution input image with the super-resolved output.
|
| 565 |
-
|
| 566 |
"""
|
| 567 |
|
| 568 |
# Determine default values now that BASE_CONFIG is initialized
|
|
|
|
| 9 |
import sys
|
| 10 |
import json # Added import
|
| 11 |
import copy
|
| 12 |
+
try:
|
| 13 |
+
import spaces
|
| 14 |
+
except ImportError:
|
| 15 |
+
print("Warning: 'spaces' module not found.")
|
| 16 |
+
class DummySpaces:
|
| 17 |
+
@staticmethod
|
| 18 |
+
def GPU(func):
|
| 19 |
+
return func
|
| 20 |
+
spaces = DummySpaces()
|
| 21 |
+
|
| 22 |
# Add project root to sys.path to allow direct import of var_post_samp
|
| 23 |
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "."))
|
| 24 |
if project_root not in sys.path:
|
|
|
|
| 561 |
sys.exit(1)
|
| 562 |
|
| 563 |
# --- Define Gradio UI using gr.Blocks after globals are initialized ---
|
| 564 |
+
title_str = """
|
| 565 |
+
<div align="center">
|
| 566 |
+
|
| 567 |
+
# FLAIR: Flow-Based Latent Alignment for Image Restoration
|
| 568 |
+
|
| 569 |
+
**Julius Erbach<sup>1</sup>, Dominik Narnhofer<sup>1</sup>, Andreas Dombos<sup>1</sup>, Jan Eric Lenssen<sup>1</sup>, Bernt Schiele<sup>2</sup>, Konrad Schindler<sup>1</sup>**
|
| 570 |
+
<br>
|
| 571 |
+
<sup>1</sup> Photogrammetry and Remote Sensing, ETH Zurich <sup>2</sup> Max Planck Institute for Informatics, Saarbrücken
|
| 572 |
+
|
| 573 |
+
<p align="center" style="margin-top: 8px;">
|
| 574 |
+
<a href="link" target="https://arxiv.org/abs/2506.02680" rel="noopener noreferrer" style="display: inline-block;">
|
| 575 |
+
<img src="https://img.shields.io/badge/arXiv-PDF-b31b1b" alt="Paper">
|
| 576 |
+
</a>
|
| 577 |
+
<a href="https://inverseFLAIR.github.io" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
|
| 578 |
+
<img src="https://img.shields.io/badge/Project-Page-green" alt="Project Page">
|
| 579 |
+
</a>
|
| 580 |
+
</p>
|
| 581 |
+
|
| 582 |
+
</div>
|
| 583 |
+
"""
|
| 584 |
description_str = """
|
| 585 |
+
**Select a task below and upload your image.** <br>
|
| 586 |
+
**Inpainting Note:** <br>
|
| 587 |
+
- Provide a descriptive prompt (e.g., "A realistic sky replacement").
|
| 588 |
+
- For large masks, increase the number of steps (up to 80) for better results.
|
| 589 |
+
**Super Resolution:** <br>
|
| 590 |
+
- Upload a either a high resolution image which will be be center cropped to 768x768 and downscaled by the selected factor, or a low-resolution image (e.g., 64x64 pixels) which will be upscaled.
|
| 591 |
+
- Or upload a low-resolution image which will be upscaled by the selected factor to 768x768. The input resolution must match the target resolution for the selected scale factor (e.g., 64x64 for x12, 32x32 for x24).
|
|
|
|
|
|
|
| 592 |
"""
|
| 593 |
|
| 594 |
# Determine default values now that BASE_CONFIG is initialized
|