Spaces:
Running
Running
import os | |
import gradio as gr | |
from PIL import Image | |
os.system( | |
'wget https://github.com/FanChiMao/SUNet/releases/download/0.0/AWGN_denoising_SUNet.pth -P experiments/pretrained_models') | |
def inference(img): | |
os.system('mkdir test') | |
#basewidth = 512 | |
#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_SUNet.py --input_dir test --weights experiments/pretrained_models/AWGN_denoising_SUNet.pth') | |
return 'result/1.png' | |
title = "SUNet: Swin Transformer with UNet for Image Denoising" | |
description = "Gradio demo for SUNet. SUNet has competitive performance results 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" | |
article = "<p style='text-align: center'><a href='https://' target='_blank'>SUNet: Swin Transformer with UNet for Image Denoising</a> | <a href='https://github.com/FanChiMao/SUNet' target='_blank'>Github Repo</a></p>" | |
examples = [['butterfly.png']] | |
gr.Interface( | |
inference, | |
[gr.inputs.Image(type="pil", label="Input")], | |
gr.outputs.Image(type="file", label="Output"), | |
title=title, | |
description=description, | |
article=article, | |
examples=examples | |
).launch(debug=True) |