Skip to content

Flask-Uwsgi based endpoints for pytesseract wrapper using Tesseract 4

License

Notifications You must be signed in to change notification settings

shams-sam/Tesseract4API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tesseract4API

Flask-Uwsgi based endpoints for pytesseract wrapper using Tesseract 4

References:

Features:

  • built on top of tesseract 4 runtime environment docker image
  • exposes functions of pytesseract wrapper
  • uses uwsgi for production deployments

Setup

#to build the image 
docker-compose build

# to run the service
docker-compose up -d

# to stop the service
docker-compose down

Python usage

import requests

image = open('path_to_image.file', 'rb').read()

# if calling from another service in docker compose
r = requests.post('http://tesseract:8888/image_to_string', files={'file': image})

# if calling from another elsewhere in docker compose
r = requests.post('http://<local_or_aws_endpoint>:8888/image_to_string', files={'file': image})

print(r.text)

# if calling to get readable pdf
r = requests.post('http://<local_or_aws_endpoint>:8888/image_to_readable_pdf', files={'file': image})

# save the readable pdf
with open('output.pdf', 'wb') as f:
    f.write(r.content)

About

Flask-Uwsgi based endpoints for pytesseract wrapper using Tesseract 4

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published