File size: 1,730 Bytes
d430426
 
 
f7c89d9
d430426
 
 
 
 
 
 
 
 
 
 
38229db
d430426
9bcc0d6
a530eb8
d430426
 
 
38229db
d430426
 
38229db
d430426
 
 
 
 
 
 
 
 
 
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
34
35
36
import os
import gradio as gr
from PIL import Image


os.system(
    'wget https://github.com/TentativeGitHub/SRMNet/releases/download/0.0/AWGN_denoising_SRMNet.pth -P experiments/pretrained_models')


def inference(img):
    os.system('mkdir test')
    basewidth = 256
    wpercent = (basewidth / float(img.size[0]))
    hsize = int((float(img.size[1]) * float(wpercent)))
    img = img.resize((basewidth, hsize), Image.ANTIALIAS)
    img.save("test/1.png", "PNG")
    os.system(
        'python main_test_SRMNet.py --input_dir test --weights experiments/pretrained_models/AWGN_denoising_SRMNet.pth')
    return 'result/out.png'


title = "Selective Residual M-Net (SRMNet)"
description = "Gradio demo for SwinIR. SwinIR achieves state-of-the-art performance on six tasks: image super-resolution (including classical, lightweight and real-world image super-resolution), image denoising (including grayscale and color image denoising) and JPEG compression artifact reduction. See the paper and project page for detailed results below. Here, we provide a demo for real-world image SR.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/2108.10257' target='_blank'>SwinIR: Image Restoration Using Swin Transformer</a> | <a href='https://github.com/JingyunLiang/SwinIR' target='_blank'>Github Repo</a></p>"

examples = [['Noise.png']]
gr.Interface(
    inference,
    [gr.inputs.Image(type="pil", label="Input")],
    gr.outputs.Image(type="file", label="Output"),
    title=title,
    description=description,
    article=article,
    enable_queue=True,
    examples=examples
).launch(debug=True)