ariansyahdedy commited on
Commit
82700d7
·
1 Parent(s): c6826bf

add tesseract-ocr

Browse files
app/__pycache__/ocr.cpython-310.pyc CHANGED
Binary files a/app/__pycache__/ocr.cpython-310.pyc and b/app/__pycache__/ocr.cpython-310.pyc differ
 
app/ocr.py CHANGED
@@ -3,7 +3,7 @@ import fitz
3
  import pytesseract
4
  from PIL import Image
5
  import cv2
6
- import io
7
  import pymupdf
8
  from fastapi import HTTPException
9
  import numpy as np
@@ -11,7 +11,14 @@ from pytesseract import Output
11
  import imutils
12
 
13
 
14
- pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
 
 
 
 
 
 
 
15
 
16
  def reformat_ocr_result(result):
17
  mapping = {
 
3
  import pytesseract
4
  from PIL import Image
5
  import cv2
6
+ import io, os
7
  import pymupdf
8
  from fastapi import HTTPException
9
  import numpy as np
 
11
  import imutils
12
 
13
 
14
+ # pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
15
+ pytesseract.pytesseract.tesseract_cmd = 'tesseract'
16
+ # if os.name == 'nt':
17
+ # # Windows
18
+ # pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
19
+ # else:
20
+ # # Unix/Linux, where tesseract should be in the PATH
21
+ # pytesseract.pytesseract.tesseract_cmd = 'tesseract'
22
 
23
  def reformat_ocr_result(result):
24
  mapping = {
temp_KTP Evan.pdf ADDED
Binary file (932 kB). View file
 
temp_WhatsApp Image 2023-08-04 at 10.48.42.jpeg ADDED
temp_page_0.png ADDED