Spaces:
Sleeping
Sleeping
Julián Tachella
commited on
Commit
·
fd548c6
1
Parent(s):
ece0ce5
test
Browse files
app.py
CHANGED
@@ -13,9 +13,9 @@ def pil_to_torch(image):
|
|
13 |
|
14 |
ref_size = 256
|
15 |
if image.shape[2] > image.shape[3]:
|
16 |
-
size = (ref_size, ref_size * image.shape[
|
17 |
else:
|
18 |
-
size = (ref_size * image.shape[
|
19 |
|
20 |
image = torch.nn.functional.interpolate(image, size=size, mode='bilinear')
|
21 |
return image
|
@@ -55,7 +55,7 @@ output_images = gr.Image(label='Denoised Image')
|
|
55 |
noise_image = gr.Image(label='Noisy Image')
|
56 |
input_image_output = gr.Image(label='Input Image')
|
57 |
|
58 |
-
noise_levels = gr.Dropdown(choices=[0.1, 0.2, 0.3, 0.
|
59 |
|
60 |
denoiser = gr.Dropdown(choices=['DnCNN', 'DRUNet', 'BM3D', 'MedianFilter', 'TV', 'TGV'], value='DnCNN', label='Denoiser')
|
61 |
|
@@ -65,7 +65,7 @@ demo = gr.Interface(
|
|
65 |
examples=[['https://deepinv.github.io/deepinv/_static/deepinv_logolarge.png', 0.1, 'DnCNN']],
|
66 |
outputs=[noise_image, output_images],
|
67 |
title="Image Denoising with DeepInverse",
|
68 |
-
description="Denoise an image using a variety of denoisers and noise levels using the deepinverse library (https://deepinv.github.io/). We only include lightweight models like DnCNN and MedianFilter as this example is intended to be run on a CPU. We also automatically resize the input image to 256
|
69 |
)
|
70 |
|
71 |
demo.launch()
|
|
|
13 |
|
14 |
ref_size = 256
|
15 |
if image.shape[2] > image.shape[3]:
|
16 |
+
size = (ref_size, ref_size * image.shape[3]//image.shape[2])
|
17 |
else:
|
18 |
+
size = (ref_size * image.shape[2]//image.shape[3], ref_size)
|
19 |
|
20 |
image = torch.nn.functional.interpolate(image, size=size, mode='bilinear')
|
21 |
return image
|
|
|
55 |
noise_image = gr.Image(label='Noisy Image')
|
56 |
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 |
|
|
|
65 |
examples=[['https://deepinv.github.io/deepinv/_static/deepinv_logolarge.png', 0.1, 'DnCNN']],
|
66 |
outputs=[noise_image, output_images],
|
67 |
title="Image Denoising with DeepInverse",
|
68 |
+
description="Denoise an image using a variety of denoisers and noise levels using the deepinverse library (https://deepinv.github.io/). We only include lightweight models like DnCNN and MedianFilter as this example is intended to be run on a CPU. We also automatically resize the input image to 256 pixels to reduce the computation time. For more advanced models, please run the code locally.",
|
69 |
)
|
70 |
|
71 |
demo.launch()
|