Spaces:
Sleeping
Sleeping
Commit
·
576acdc
1
Parent(s):
3e2d4f9
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,32 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
4 |
-
def image_mod(image):
|
5 |
-
return image.rotate(45)
|
6 |
|
7 |
os.system("git clone https://github.com/megvii-research/NAFNet")
|
8 |
os.system("mv NAFNet/* ./")
|
9 |
-
|
10 |
-
|
11 |
os.system("python3 setup.py develop --no_cuda_ext")
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
title = "NAFNet"
|
14 |
description = "Gradio demo for <b>NAFNet: Nonlinear Activation Free Network for Image Restoration</b>. NAFNet achieves state-of-the-art performance on three tasks: image denoising, image debluring and stereo image super-resolution. See the paper and project page for detailed results below. Here, we provide a demo for image denoise and deblur. To use it, simply upload your image, or click one of the examples to load them."
|
15 |
-
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2204.04676' target='_blank'>Simple Baselines for Image Restoration</a>
|
16 |
|
17 |
-
inference = image_mod
|
18 |
|
19 |
examples = [['demo/noisy.png', 'Denoising'],
|
20 |
['demo/blurry.jpg', 'Deblurring']]
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
|
|
|
|
4 |
|
5 |
os.system("git clone https://github.com/megvii-research/NAFNet")
|
6 |
os.system("mv NAFNet/* ./")
|
7 |
+
os.system("mv NAFNet-REDS-width64.pth experiments/pretrained_models/")
|
8 |
+
os.system("mv NAFNet-SIDD-width64.pth experiments/pretrained_models/")
|
9 |
os.system("python3 setup.py develop --no_cuda_ext")
|
10 |
|
11 |
+
|
12 |
+
def inference(image, task):
|
13 |
+
if not os.path.exists('temp'):
|
14 |
+
os.system('mkdir temp')
|
15 |
+
img.save("temp/image.png", "PNG")
|
16 |
+
|
17 |
+
if task == 'Denoising':
|
18 |
+
os.system("python basicsr/demo.py -opt options/test/SIDD/NAFNet-width64.yml --input_path ./temp/image.png --output_path ./temp/image.png")
|
19 |
+
|
20 |
+
if task == 'Deblurring':
|
21 |
+
os.system("python basicsr/demo.py -opt options/test/REDS/NAFNet-width64.yml --input_path ./temp/image.png --output_path ./temp/image.png")
|
22 |
+
|
23 |
+
return f'temp/{task}/image.jpg'
|
24 |
+
|
25 |
+
|
26 |
title = "NAFNet"
|
27 |
description = "Gradio demo for <b>NAFNet: Nonlinear Activation Free Network for Image Restoration</b>. NAFNet achieves state-of-the-art performance on three tasks: image denoising, image debluring and stereo image super-resolution. See the paper and project page for detailed results below. Here, we provide a demo for image denoise and deblur. To use it, simply upload your image, or click one of the examples to load them."
|
28 |
+
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2204.04676' target='_blank'>Simple Baselines for Image Restoration</a> | <a href='https://arxiv.org/abs/2204.08714' target='_blank'>NAFSSR: Stereo Image Super-Resolution Using NAFNet</a> | <a href='https://github.com/megvii-research/NAFNet' target='_blank'> Github Repo</a></p>"
|
29 |
|
|
|
30 |
|
31 |
examples = [['demo/noisy.png', 'Denoising'],
|
32 |
['demo/blurry.jpg', 'Deblurring']]
|