Spaces:
Running
Running
SathyaSantosh77 commited on
Commit Β·
66e1339
1
Parent(s): 7cc3a98
fix examples, autocast, add spaces dependency
Browse files- app.py +5 -5
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import torch.nn as nn
|
|
| 4 |
import torch.nn.functional as F
|
| 5 |
import torchvision.transforms.functional as TF
|
| 6 |
import math
|
| 7 |
-
import
|
| 8 |
import numpy as np
|
| 9 |
from PIL import Image
|
| 10 |
|
|
@@ -197,6 +197,7 @@ print(f"Best val PSNR: {checkpoint['val_psnr']:.2f} dB")
|
|
| 197 |
|
| 198 |
|
| 199 |
# ββ Inference βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 200 |
def run_sr(img_pil):
|
| 201 |
"""
|
| 202 |
Takes any PIL image.
|
|
@@ -264,11 +265,11 @@ def run_sr(img_pil):
|
|
| 264 |
# smooth skin + sharp boundary, urban grid, natural foliage
|
| 265 |
EXAMPLES = [
|
| 266 |
["examples/urban.png"],
|
| 267 |
-
["examples/
|
| 268 |
-
["examples/document.png"],
|
| 269 |
-
["examples/portrait.png"],
|
| 270 |
["examples/architecture.png"],
|
| 271 |
["examples/nature.png"],
|
|
|
|
|
|
|
| 272 |
]
|
| 273 |
|
| 274 |
|
|
@@ -470,7 +471,6 @@ with gr.Blocks(css=CSS, title="Dense-Iso-ViT SR") as demo:
|
|
| 470 |
examples=EXAMPLES,
|
| 471 |
inputs=[input_img],
|
| 472 |
label="Examples β showing V4 strengths",
|
| 473 |
-
elem_classes=["examples-holder"],
|
| 474 |
)
|
| 475 |
|
| 476 |
# collapsible architecture info
|
|
|
|
| 4 |
import torch.nn.functional as F
|
| 5 |
import torchvision.transforms.functional as TF
|
| 6 |
import math
|
| 7 |
+
import spaces
|
| 8 |
import numpy as np
|
| 9 |
from PIL import Image
|
| 10 |
|
|
|
|
| 197 |
|
| 198 |
|
| 199 |
# ββ Inference βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 200 |
+
@spaces.GPU
|
| 201 |
def run_sr(img_pil):
|
| 202 |
"""
|
| 203 |
Takes any PIL image.
|
|
|
|
| 265 |
# smooth skin + sharp boundary, urban grid, natural foliage
|
| 266 |
EXAMPLES = [
|
| 267 |
["examples/urban.png"],
|
| 268 |
+
["examples/aerial.png"],
|
|
|
|
|
|
|
| 269 |
["examples/architecture.png"],
|
| 270 |
["examples/nature.png"],
|
| 271 |
+
["examples/portrait.png"],
|
| 272 |
+
["examples/texture.png"],
|
| 273 |
]
|
| 274 |
|
| 275 |
|
|
|
|
| 471 |
examples=EXAMPLES,
|
| 472 |
inputs=[input_img],
|
| 473 |
label="Examples β showing V4 strengths",
|
|
|
|
| 474 |
)
|
| 475 |
|
| 476 |
# collapsible architecture info
|
requirements.txt
CHANGED
|
@@ -3,3 +3,4 @@ torchvision>=0.15.0
|
|
| 3 |
Pillow>=9.0.0
|
| 4 |
numpy>=1.24.0
|
| 5 |
huggingface_hub<1.0
|
|
|
|
|
|
| 3 |
Pillow>=9.0.0
|
| 4 |
numpy>=1.24.0
|
| 5 |
huggingface_hub<1.0
|
| 6 |
+
spaces
|