Spaces:
Runtime error
Runtime error
chuxiaojie
commited on
Commit
•
973388b
1
Parent(s):
86022a1
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,32 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
def
|
4 |
-
return
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
|
4 |
+
def image_mod(image):
|
5 |
+
return image.rotate(45)
|
6 |
|
7 |
+
os.system("git clone https://github.com/megvii-research/NAFNet")
|
8 |
+
os.system("cd NAFNet")
|
9 |
+
#os.system("pip install -r requirements.txt")
|
10 |
+
os.system("python3 setup.py develop --no_cuda_ext")
|
11 |
+
|
12 |
+
title = "NAFNet"
|
13 |
+
description = "Gradio demo for <b>NAFNet: Nonlinear Activation Free Network for Image Restoration</b>. NAFNet achieves state-of-the-art performance on three tasks: image denoising, image debluring and stereo image super-resolution. See the paper and project page for detailed results below. Here, we provide a demo for image denoise and deblur. To use it, simply upload your image, or click one of the examples to load them."
|
14 |
+
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2204.04676' target='_blank'>Simple Baselines for Image Restoration</a> |<a href='https://arxiv.org/abs/2204.08714' target='_blank'>NAFSSR: Stereo Image Super-Resolution Using NAFNet</a> |<a href='https://github.com/megvii-research/NAFNet' target='_blank'>Github Repo</a></p>"
|
15 |
+
|
16 |
+
inference = image_mod
|
17 |
+
|
18 |
+
examples = [['demo/noisy.png', 'Denoising'],
|
19 |
+
['demo/blurry.jpg', 'Deblurring']]
|
20 |
+
|
21 |
+
iface = gr.Interface(
|
22 |
+
inference,
|
23 |
+
[gr.inputs.Image(type="pil", label="Input"),
|
24 |
+
gr.inputs.Radio(["Denoising", "Deblurring"], default="Denoising", label='task'),],
|
25 |
+
gr.outputs.Image(type="file", label="Output"),
|
26 |
+
title=title,
|
27 |
+
description=description,
|
28 |
+
article=article,
|
29 |
+
enable_queue=True,
|
30 |
+
examples=examples
|
31 |
+
)
|
32 |
+
iface.launch(debug=True,enable_queue=True)
|