diff --git a/1317.jpg b/1317.jpg new file mode 100644 index 0000000..7127210 Binary files /dev/null and b/1317.jpg differ diff --git a/README.md b/README.md index 205674c..ff0e640 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,11 @@ docker-compose up -d docker-compose down ``` +### Usage +``` +curl -F 'file=@./test-22.jpg' -F 'lang=mon+eng+eq' -F 'config=--psm 6' localhost:8888/image_to_string +``` + ### Python usage ```python diff --git a/tesseract/app.py b/tesseract/app.py index 9b4793c..77ef18f 100644 --- a/tesseract/app.py +++ b/tesseract/app.py @@ -41,8 +41,10 @@ def get_readable_pdf(): @app.route("/image_to_string", methods=["POST"]) def image_to_string(): file = request.files.getlist("file") + lang = request.form.get('lang', 'mon') + config = request.form.get('config', '--psm 6') image = Image.open(file[0]) - result = pytesseract.image_to_string(image, config="--psm 4") + result = pytesseract.image_to_string(image, config=config, lang=lang) return result diff --git a/test-22.jpg b/test-22.jpg new file mode 100644 index 0000000..9b68841 Binary files /dev/null and b/test-22.jpg differ