Spaces:
Runtime error
Runtime error
File size: 1,487 Bytes
7169478 93089af 7169478 bed98da 7169478 9e72bf8 7169478 |
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 38 39 40 41 42 43 |
import gradio as gr
import os
os.system("git clone https://github.com/megvii-research/NAFNet")
os.system("mv NAFNet/* ./")
os.system("mv *.pth experiments/pretrained_models/")
os.system("python3 setup.py develop --no_cuda_ext --user")
def inference(image, task):
if not os.path.exists('tmp'):
os.system('mkdir tmp')
image.save("tmp/lq_image.png", "PNG")
if task == 'Denoising':
os.system("python basicsr/demo.py -opt options/test/SIDD/NAFNet-width64.yml --input_path ./tmp/lq_image.png --output_path ./tmp/image.png")
if task == 'Deblurring':
os.system("python basicsr/demo.py -opt options/test/REDS/NAFNet-width64.yml --input_path ./tmp/lq_image.png --output_path ./tmp/image.png")
return 'tmp/image.png'
title = "image deblurring"
description = " - performance on three tasks: image denoising, image deblurring. Here, we provide a demo for image denoise and deblur. "
article = "<p style='text-align: center'> | Ogunwale felix</p>"
examples = [['demo/noisy.png', 'Denoising'],
['demo/blurry.jpg', 'Deblurring']]
iface = gr.Interface(
inference,
[gr.inputs.Image(type="pil", label="Input"),
gr.inputs.Radio(["Denoising", "Deblurring"], default="Denoising", label='task'),],
gr.outputs.Image(type="file", label="Output"),
title=title,
description=description,
article=article,
enable_queue=True,
examples=examples
)
iface.launch(debug=True,enable_queue=True) |