File size: 1,604 Bytes
86022a1
973388b
86022a1
973388b
 
86022a1
973388b
704454d
01dd9e0
973388b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
import os

def image_mod(image):
    return image.rotate(45)

os.system("git clone https://github.com/megvii-research/NAFNet")
os.system("mv NAFNet/* ./")
print(os.listdir('.'))
#os.system("pip install -r requirements.txt")
os.system("python3 setup.py develop --no_cuda_ext")

title = "NAFNet"
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."
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>"

inference = image_mod

examples = [['demo/noisy.png', 'Denoising'],
            ['demo/blurry.jpg', 'Deblurring']]
            
iface = gr.Interface(
    inference, 
    [gr.inputs.Image(type="pil", label="Input"),
    gr.inputs.Radio(["Denoising", "Deblurring"], default="Denoising", label='task'),], 
    gr.outputs.Image(type="file", label="Output"),
    title=title,
    description=description,
    article=article,
    enable_queue=True,
    examples=examples
    )
iface.launch(debug=True,enable_queue=True)