Git Product home page Git Product logo

tesseract-ocr-lambda-function's Introduction

tesseract-ocr-lambda-function

Python 3.7 Language grade: Python Total alerts License
AWS Lambda function that executes Tesseract (Optimal Character Recognition Engine) on Base 64 encoded images.
The function also implements horizontal whitespace detection through use of Tesseract's TSV output.

Dependencies

  • Tesseract-OCR
  • Windows
    • Required for local testing.
  • Python 3.7.5
    • Required for local testing.
    • The Tesseract Linux binary in this repo is only compatible with Amazon Linux 1, which corresponds to Lambda Python runtimes ≤ Version 3.7.5.

Testing

Local testing is supported only for Windows.
Modify /test_suite to add test cases.
Execute ocr_tester.py to run tests.

Usage

Include a Base 64 encoded image in the function invocation payload.
The function will return a JSON response with the following variables:

  • text - String containing the recognized text or error info.
  • statusCode - Integer representing function success status. See table below:
Result Status Code
Success 200
Invalid Base 64 400
OCR error 500

Deployment

  1. Create a ZIP file with the following structure (tested using 7 Zip):
    .
    ├── lambda_handler.py
    ├── ocr.py
    └── dependencies
        └── tesseract_ocr_linux
  1. Sign up for an AWS account.
  2. Create S3 bucket.
  3. Upload ZIP file to S3 bucket.
  4. Create Lambda function.
  5. Configure Lambda function with the following settings:
Setting Value
Runtime Python 3.7
Handler lambda_handler.lambda_handler
Timeout 30+ seconds
  1. Import source code from S3 bucket ZIP file.
  2. Ready to use!

tesseract-ocr-lambda-function's People

Contributors

blakejordan avatar sethepeterson avatar

Watchers

 avatar

Forkers

blakejordan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.