Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import numpy as np
|
|
4 |
|
5 |
|
6 |
|
7 |
-
def inference(img):
|
8 |
#out = cv2.erode(img,(15,15))
|
9 |
#out = cv2.dilate(out,(55,55))
|
10 |
# https://scikit-image.org/docs/dev/api/skimage.morphology.html#skimage.morphology.remove_small_objects
|
@@ -22,7 +22,8 @@ def inference(img):
|
|
22 |
#out = cv2.adaptiveThreshold(gray,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,133,9)
|
23 |
#out = cv2.adaptiveThreshold(gray,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,333,3)
|
24 |
out = cv2.GaussianBlur( gray ,(5,5),0)
|
25 |
-
|
|
|
26 |
#out = cv2.dilate(out,(5,5))
|
27 |
#out = blur = cv.GaussianBlur(img,(5,5),0)
|
28 |
#out = cv2.threshold(out,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
|
@@ -38,7 +39,7 @@ def inference(img):
|
|
38 |
# For Spaces usage, head to https://huggingface.co/docs/hub/spaces
|
39 |
iface = gradio.Interface(
|
40 |
fn=inference,
|
41 |
-
inputs='image',
|
42 |
outputs='image',
|
43 |
title='Noise Removal',
|
44 |
description='Remove Noise with OpenCV and Adaptial Gaussian!',
|
|
|
4 |
|
5 |
|
6 |
|
7 |
+
def inference(img,v1='121',v2='3'):
|
8 |
#out = cv2.erode(img,(15,15))
|
9 |
#out = cv2.dilate(out,(55,55))
|
10 |
# https://scikit-image.org/docs/dev/api/skimage.morphology.html#skimage.morphology.remove_small_objects
|
|
|
22 |
#out = cv2.adaptiveThreshold(gray,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,133,9)
|
23 |
#out = cv2.adaptiveThreshold(gray,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,333,3)
|
24 |
out = cv2.GaussianBlur( gray ,(5,5),0)
|
25 |
+
# v1 121 , v2 1
|
26 |
+
out = cv2.adaptiveThreshold( out ,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,v1,v2)
|
27 |
#out = cv2.dilate(out,(5,5))
|
28 |
#out = blur = cv.GaussianBlur(img,(5,5),0)
|
29 |
#out = cv2.threshold(out,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
|
|
|
39 |
# For Spaces usage, head to https://huggingface.co/docs/hub/spaces
|
40 |
iface = gradio.Interface(
|
41 |
fn=inference,
|
42 |
+
inputs=['image','v1','v2'],
|
43 |
outputs='image',
|
44 |
title='Noise Removal',
|
45 |
description='Remove Noise with OpenCV and Adaptial Gaussian!',
|