import os import gradio as gr from PIL import Image import torch os.system( 'wget https://github.com/FanChiMao/CMFNet/releases/download/v0.0/deblur_GoPro_CMFNet.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.BILINEAR) img.save("test/1.png", "PNG") os.system( 'python main_test_CMFNet.py --input_dir test --weights experiments/pretrained_models/deblur_GoPro_CMFNet.pth') return 'results/1.png' title = "Compound Multi-branch Feature Fusion (Deblur)" description = "Gradio demo for CMFNet. CMFNet 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 = "

SwinIR: Image Restoration Using Swin Transformer | Github Repo

" examples = [['Haze.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)