Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import argparse
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
import os
|
| 5 |
import torch
|
|
@@ -13,7 +15,6 @@ from models.safmn_arch import SAFMN
|
|
| 13 |
from gradio_imageslider import ImageSlider
|
| 14 |
|
| 15 |
|
| 16 |
-
########################################## Gradio inference ###################################
|
| 17 |
pretrain_model_url = {
|
| 18 |
'safmn_x2': 'https://github.com/sunny2109/SAFMN/releases/download/v0.1.0/SAFMN_L_Real_LSDIR_x2-v2.pth',
|
| 19 |
'safmn_x4': 'https://github.com/sunny2109/SAFMN/releases/download/v0.1.0/SAFMN_L_Real_LSDIR_x4-v2.pth',
|
|
@@ -171,7 +172,8 @@ title = "SAFMN for Real-world SR"
|
|
| 171 |
description = ''' ### Spatially-Adaptive Feature Modulation for Efficient Image Super-Resolution - ICCV 2023
|
| 172 |
#### Long Sun](https://github.com/sunny2109), [Jiangxin Dong](https://scholar.google.com/citations?user=ruebFVEAAAAJ&hl=zh-CN&oi=ao), [Jinhui Tang](https://scholar.google.com/citations?user=ByBLlEwAAAAJ&hl=zh-CN), and [Jinshan Pan](https://jspan.github.io/)
|
| 173 |
#### [IMAG Lab](https://imag-njust.net/), Nanjing University of Science and Technology
|
| 174 |
-
####
|
|
|
|
| 175 |
<br>
|
| 176 |
### If our work is useful for your research, please consider citing:
|
| 177 |
<code>
|
|
@@ -214,9 +216,9 @@ demo = gr.Interface(
|
|
| 214 |
fn=inference,
|
| 215 |
inputs=[
|
| 216 |
gr.Image(value="real_testdata/004.png", type="pil", label="Input"),
|
| 217 |
-
gr.Number(
|
| 218 |
-
gr.Checkbox(
|
| 219 |
-
gr.Checkbox(
|
| 220 |
],
|
| 221 |
outputs=ImageSlider(label="Super-Resolved Image",
|
| 222 |
type="pil",
|
|
|
|
| 1 |
import os
|
| 2 |
+
import cv2
|
| 3 |
import argparse
|
| 4 |
+
import glob
|
| 5 |
import numpy as np
|
| 6 |
import os
|
| 7 |
import torch
|
|
|
|
| 15 |
from gradio_imageslider import ImageSlider
|
| 16 |
|
| 17 |
|
|
|
|
| 18 |
pretrain_model_url = {
|
| 19 |
'safmn_x2': 'https://github.com/sunny2109/SAFMN/releases/download/v0.1.0/SAFMN_L_Real_LSDIR_x2-v2.pth',
|
| 20 |
'safmn_x4': 'https://github.com/sunny2109/SAFMN/releases/download/v0.1.0/SAFMN_L_Real_LSDIR_x4-v2.pth',
|
|
|
|
| 172 |
description = ''' ### Spatially-Adaptive Feature Modulation for Efficient Image Super-Resolution - ICCV 2023
|
| 173 |
#### Long Sun](https://github.com/sunny2109), [Jiangxin Dong](https://scholar.google.com/citations?user=ruebFVEAAAAJ&hl=zh-CN&oi=ao), [Jinhui Tang](https://scholar.google.com/citations?user=ByBLlEwAAAAJ&hl=zh-CN), and [Jinshan Pan](https://jspan.github.io/)
|
| 174 |
#### [IMAG Lab](https://imag-njust.net/), Nanjing University of Science and Technology
|
| 175 |
+
#### Drag the slider on the super-resolution image left and right to see the changes in the image details.
|
| 176 |
+
#### SAFMN performs x2/x4 upscaling on the input image. If the input image is larger than 720P, it is recommended to use Memory-efficient inference.
|
| 177 |
<br>
|
| 178 |
### If our work is useful for your research, please consider citing:
|
| 179 |
<code>
|
|
|
|
| 216 |
fn=inference,
|
| 217 |
inputs=[
|
| 218 |
gr.Image(value="real_testdata/004.png", type="pil", label="Input"),
|
| 219 |
+
gr.Number(default=10, label="Upscaling factor (up to 4)"),
|
| 220 |
+
gr.Checkbox(default=False, label="Memory-efficient inference"),
|
| 221 |
+
gr.Checkbox(default=False, label="Color correction"),
|
| 222 |
],
|
| 223 |
outputs=ImageSlider(label="Super-Resolved Image",
|
| 224 |
type="pil",
|