Faiss commited on
Commit
f9d9d3e
1 Parent(s): c10c0c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -4,7 +4,10 @@ import os
4
 
5
  def process(image: str, lang: str = 'eng') -> str:
6
  try:
7
- result = pytesseract.image_to_string(image, lang=lang)
 
 
 
8
  os.remove(image)
9
  return result
10
  except Exception as e:
 
4
 
5
  def process(image: str, lang: str = 'eng') -> str:
6
  try:
7
+ img = cv2.imread(image)
8
+ gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
9
+ threshold_img = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
10
+ result = pytesseract.image_to_string(threshold_img, lang=lang)
11
  os.remove(image)
12
  return result
13
  except Exception as e: