Spaces:
Sleeping
Sleeping
Julián Tachella
commited on
Commit
·
69590ad
1
Parent(s):
a4dc15b
test
Browse files
app.py
CHANGED
@@ -32,7 +32,9 @@ def torch_to_pil(image):
|
|
32 |
def image_mod(image, noise_level, denoiser):
|
33 |
image = pil_to_torch(image)
|
34 |
if denoiser == 'DnCNN':
|
35 |
-
|
|
|
|
|
36 |
elif denoiser == 'MedianFilter':
|
37 |
denoiser = dinv.models.MedianFilter(kernel_size=5)
|
38 |
elif denoiser == 'BM3D':
|
@@ -41,6 +43,8 @@ def image_mod(image, noise_level, denoiser):
|
|
41 |
denoiser = dinv.models.TVDenoiser()
|
42 |
elif denoiser == 'TGV':
|
43 |
denoiser = dinv.models.TGVDenoiser()
|
|
|
|
|
44 |
elif denoiser == 'DRUNet':
|
45 |
denoiser = dinv.models.DRUNet()
|
46 |
else:
|
@@ -57,7 +61,7 @@ input_image_output = gr.Image(label='Input Image')
|
|
57 |
|
58 |
noise_levels = gr.Dropdown(choices=[0.1, 0.2, 0.3, 0.5, 1], value=0.1, label='Noise Level')
|
59 |
|
60 |
-
denoiser = gr.Dropdown(choices=['DnCNN', 'DRUNet', 'BM3D', 'MedianFilter', 'TV', 'TGV'], value='DnCNN', label='Denoiser')
|
61 |
|
62 |
demo = gr.Interface(
|
63 |
image_mod,
|
|
|
32 |
def image_mod(image, noise_level, denoiser):
|
33 |
image = pil_to_torch(image)
|
34 |
if denoiser == 'DnCNN':
|
35 |
+
den = dinv.models.DnCNN()
|
36 |
+
sigma0 = 2/255
|
37 |
+
denoiser = lambda x, sigma: den(x*sigma0/sigma)
|
38 |
elif denoiser == 'MedianFilter':
|
39 |
denoiser = dinv.models.MedianFilter(kernel_size=5)
|
40 |
elif denoiser == 'BM3D':
|
|
|
43 |
denoiser = dinv.models.TVDenoiser()
|
44 |
elif denoiser == 'TGV':
|
45 |
denoiser = dinv.models.TGVDenoiser()
|
46 |
+
elif denoiser == 'SwinIR':
|
47 |
+
denoiser = dinv.models.SwinIR()
|
48 |
elif denoiser == 'DRUNet':
|
49 |
denoiser = dinv.models.DRUNet()
|
50 |
else:
|
|
|
61 |
|
62 |
noise_levels = gr.Dropdown(choices=[0.1, 0.2, 0.3, 0.5, 1], value=0.1, label='Noise Level')
|
63 |
|
64 |
+
denoiser = gr.Dropdown(choices=['DnCNN', 'DRUNet', 'SwinIR', 'BM3D', 'MedianFilter', 'TV', 'TGV'], value='DnCNN', label='Denoiser')
|
65 |
|
66 |
demo = gr.Interface(
|
67 |
image_mod,
|