Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ from skimage.morphology import closing, square, disk
|
|
14 |
|
15 |
|
16 |
def inference(img):
|
17 |
-
|
18 |
#binarized = np.where(grayscale>0.1, 1, 0)
|
19 |
#processed = morphology.remove_small_objects(grayscale.astype(bool), min_size=33, connectivity=4).astype(int)
|
20 |
|
@@ -36,9 +36,9 @@ def inference(img):
|
|
36 |
|
37 |
#denoise = restoration.denoise_tv_chambolle( out , weight=0.1)
|
38 |
#thresh = threshold_otsu(denoise)
|
39 |
-
thresh = threshold_otsu(
|
40 |
#out = closing(denoise > thresh, square(2))
|
41 |
-
out =
|
42 |
|
43 |
|
44 |
return out
|
|
|
14 |
|
15 |
|
16 |
def inference(img):
|
17 |
+
gray = skimage.color.rgb2gray(img) # gray
|
18 |
#binarized = np.where(grayscale>0.1, 1, 0)
|
19 |
#processed = morphology.remove_small_objects(grayscale.astype(bool), min_size=33, connectivity=4).astype(int)
|
20 |
|
|
|
36 |
|
37 |
#denoise = restoration.denoise_tv_chambolle( out , weight=0.1)
|
38 |
#thresh = threshold_otsu(denoise)
|
39 |
+
thresh = threshold_otsu(gray)
|
40 |
#out = closing(denoise > thresh, square(2))
|
41 |
+
out = gray > thresh
|
42 |
|
43 |
|
44 |
return out
|