Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ def process(image: str, lang: str = 'eng') -> str:
|
|
4 |
try:
|
5 |
img = cv2.imread(image)
|
6 |
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
7 |
-
threshold_img = cv2.threshold(gray, 127, 255, cv2.THRESH_TOZERO)
|
8 |
result = pytesseract.image_to_string(threshold_img, lang=lang)
|
9 |
os.remove(image)
|
10 |
return result
|
|
|
4 |
try:
|
5 |
img = cv2.imread(image)
|
6 |
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
7 |
+
_,threshold_img = cv2.threshold(gray, 127, 255, cv2.THRESH_TOZERO)
|
8 |
result = pytesseract.image_to_string(threshold_img, lang=lang)
|
9 |
os.remove(image)
|
10 |
return result
|