alecinvan commited on
Commit
c6d084c
1 Parent(s): bc42782

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -72,18 +72,23 @@ def ocr_lang(lang_list):
72
  return lang_str
73
 
74
 
75
- import pytesseract
76
- import os
77
 
78
  # Set Tesseract executable path in Colab virtal environment
79
- pytesseract.pytesseract.tesseract_cmd = "/usr/bin/tesseract"
80
 
81
  # Set up the Tesseract data directory
82
- os.environ["TESSDATA_PREFIX"] = "/usr/share/tesseract-ocr/4.00/tessdata"
 
 
 
 
 
83
 
 
84
  def ocr_tesseract(img, languages):
85
- custom_config = f'--oem 3 --psm 6 -l {ocr_lang(languages)}'
86
- ocr_str = pytesseract.image_to_string(img, config=custom_config)
87
  return ocr_str
88
 
89
 
 
72
  return lang_str
73
 
74
 
75
+ #import pytesseract
76
+
77
 
78
  # Set Tesseract executable path in Colab virtal environment
79
+ #pytesseract.pytesseract.tesseract_cmd = "/usr/bin/tesseract"
80
 
81
  # Set up the Tesseract data directory
82
+ #os.environ["TESSDATA_PREFIX"] = "/usr/share/tesseract-ocr/4.00/tessdata"
83
+
84
+ #def ocr_tesseract(img, languages):
85
+ # custom_config = f'--oem 3 --psm 6 -l {ocr_lang(languages)}'
86
+ # ocr_str = pytesseract.image_to_string(img, config=custom_config)
87
+ # return ocr_str
88
 
89
+ # ocr tesseract
90
  def ocr_tesseract(img, languages):
91
+ ocr_str = pytesseract.image_to_string(img, lang=ocr_lang(languages))
 
92
  return ocr_str
93
 
94