File size: 1,817 Bytes
a3ad0c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0d5ccd2
a3ad0c1
 
 
 
 
b667afd
a3ad0c1
 
 
 
 
 
aba8da1
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
37
import os
import gradio as gr
from PIL import Image


os.system(
    'wget https://github.com/FanChiMao/SRMNet/releases/download/0.0/real_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/real_denoising_SRMNet.pth')
    return 'result/1.png'


title = "Selective Residual M-Net for Real-world Image Denoising"
description = "Gradio demo for SRMNet. SRMNet has competitive performance results on two synthetic and two realworld noisy datasets in terms of quantitative metrics and visual quality. See the paper and project page for detailed results below. Here, we provide a demo for real-world image denoising. To use it, simply upload your image, or click one of the examples to load them. Reference from: https://huggingface.co/akhaliq"
article = "<p style='text-align: center'><a href='https://ieeexplore.ieee.org/document/9909521' target='_blank'>Selective Residual M-Net</a> | <a href='https://github.com/FanChiMao/SRMNet' target='_blank'>Github Repo</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=52Hz_SRMNet_real_world_denoising' alt='visitor badge'></center>"

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