CoolFace
Apppublic

52Hz/SRMNet_AWGN_denoising

sourceHugging Faceupdated 2y agoView on Hugging Face
13likes
app.py36 linesDownload Raw Back to root
1import os2import gradio as gr3from PIL import Image4 5 6os.system(7    'wget https://github.com/FanChiMao/SRMNet/releases/download/0.0/AWGN_denoising_SRMNet.pth -P experiments/pretrained_models')8 9 10def inference(img):11    os.system('mkdir test')12    #basewidth = 51213    #wpercent = (basewidth / float(img.size[0]))14    #hsize = int((float(img.size[1]) * float(wpercent)))15    #img = img.resize((basewidth, hsize), Image.ANTIALIAS)16    img.save("test/1.png", "PNG")17    os.system(18        'python main_test_SRMNet.py --input_dir test --weights experiments/pretrained_models/AWGN_denoising_SRMNet.pth')19    return 'result/1.png'20 21 22title = "Selective Residual M-Net for Real-world Image Denoising"23description = "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 AWGN image denoising. To use it, simply upload your image, or click one of the examples to load them. Reference from: https://huggingface.co/akhaliq"24article = "<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_AWGN_denoising' alt='visitor badge'></center>"25 26examples = [['set5/baby.png'], ['set5/bird.png'],['set5/butterfly.png'],['set5/head.png'],['set5/woman.png']]27gr.Interface(28    inference,29    [gr.components.Image(type="pil", label="Input")],30    gr.components.Image(type="filepath", label="Output"),31    title=title,32    description=description,33    article=article,34    examples=examples35).launch(debug=True)36