Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
import gradio
|
|
|
2 |
|
3 |
|
4 |
-
import matplotlib.pyplot as plt
|
5 |
-
from skimage import morphology,measure,feature
|
6 |
-
from skimage.measure import label
|
7 |
-
|
8 |
-
import skimage
|
|
|
|
|
|
|
|
|
9 |
|
10 |
|
11 |
def inference(img):
|
@@ -29,8 +34,11 @@ def inference(img):
|
|
29 |
#mask_x, mask_y = np.where(processed == 0)
|
30 |
#im[mask_x, mask_y, :3] = 0
|
31 |
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
#return img
|
34 |
return out
|
35 |
|
36 |
# For information on Interfaces, head to https://gradio.app/docs/
|
|
|
1 |
import gradio
|
2 |
+
import numpy as np
|
3 |
|
4 |
|
5 |
+
#import matplotlib.pyplot as plt
|
6 |
+
#from skimage import morphology,measure,feature
|
7 |
+
#from skimage.measure import label
|
8 |
+
|
9 |
+
#import skimage
|
10 |
+
|
11 |
+
from skimage import restoration
|
12 |
+
from skimage.filters import threshold_otsu, rank
|
13 |
+
from skimage.morphology import closing, square, disk
|
14 |
|
15 |
|
16 |
def inference(img):
|
|
|
34 |
#mask_x, mask_y = np.where(processed == 0)
|
35 |
#im[mask_x, mask_y, :3] = 0
|
36 |
|
37 |
+
denoise = restoration.denoise_tv_chambolle( out , weight=0.1)
|
38 |
+
thresh = threshold_otsu(denoise)
|
39 |
+
out = closing(denoise > thresh, square(2))
|
40 |
+
|
41 |
|
|
|
42 |
return out
|
43 |
|
44 |
# For information on Interfaces, head to https://gradio.app/docs/
|