Spaces:
Runtime error
Runtime error
Julián Tachella
commited on
Commit
·
52893ae
1
Parent(s):
816f746
test
Browse files
app.py
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
|
|
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
def image_mod(image):
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
demo = gr.Interface(
|
| 9 |
image_mod,
|
| 10 |
gr.Image(type="pil"),
|
| 11 |
"image",
|
| 12 |
flagging_options=["blurry", "incorrect", "other"],
|
| 13 |
-
examples=[
|
| 14 |
-
os.path.join(os.path.dirname(__file__), "images/cheetah1.jpg"),
|
| 15 |
-
os.path.join(os.path.dirname(__file__), "images/lion.jpg"),
|
| 16 |
-
os.path.join(os.path.dirname(__file__), "images/logo.png"),
|
| 17 |
-
os.path.join(os.path.dirname(__file__), "images/tower.jpg"),
|
| 18 |
-
],
|
| 19 |
)
|
| 20 |
|
| 21 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
+
import deepinv as dinv
|
| 4 |
+
import torch
|
| 5 |
|
| 6 |
|
| 7 |
def image_mod(image):
|
| 8 |
+
denoiser = dinv.models.BM3D()
|
| 9 |
+
image = torch.tensor(image).unsqueeze(0)
|
| 10 |
+
image = denoiser(image)
|
| 11 |
+
image = image.squeeze(0).cpu().detach().numpy()
|
| 12 |
+
return image
|
| 13 |
|
| 14 |
demo = gr.Interface(
|
| 15 |
image_mod,
|
| 16 |
gr.Image(type="pil"),
|
| 17 |
"image",
|
| 18 |
flagging_options=["blurry", "incorrect", "other"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
)
|
| 20 |
|
| 21 |
demo.launch()
|