same psm
Browse files- handler.py +2 -1
handler.py
CHANGED
@@ -3,6 +3,7 @@ from transformers import LayoutLMForTokenClassification, LayoutLMv2Processor
|
|
3 |
import torch
|
4 |
from subprocess import run
|
5 |
import pytesseract
|
|
|
6 |
|
7 |
# install tesseract-ocr and pytesseract
|
8 |
run("apt install -y tesseract-ocr", shell=True, check=True)
|
@@ -30,5 +31,5 @@ class EndpointHandler:
|
|
30 |
# process input
|
31 |
image = data.pop("inputs", data)
|
32 |
|
33 |
-
result = pytesseract.image_to_string(image)
|
34 |
return {"predictions": result}
|
|
|
3 |
import torch
|
4 |
from subprocess import run
|
5 |
import pytesseract
|
6 |
+
from pytesseract import Output
|
7 |
|
8 |
# install tesseract-ocr and pytesseract
|
9 |
run("apt install -y tesseract-ocr", shell=True, check=True)
|
|
|
31 |
# process input
|
32 |
image = data.pop("inputs", data)
|
33 |
|
34 |
+
result = pytesseract.image_to_string(image, config='--psm 3', output_type=Output.STRING)
|
35 |
return {"predictions": result}
|