GithubHelp home page GithubHelp logo

cnqfzhang / aws-lambda-tesseract Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shelfio/aws-lambda-tesseract

0.0 0.0 0.0 11 MB

11 MB Tesseract (with English training data) to fit inside AWS Lambda compressed with Brotli

License: MIT License

Shell 46.78% JavaScript 53.22%

aws-lambda-tesseract's Introduction

aws-lambda-tesseract CircleCI Tesseract

11 MB Tesseract (with English training data) to fit inside AWS Lambda compressed with Brotli

Inspired by chrome-aws-lambda & lambda-scanner-ocr

Install

$ yarn add @shelf/aws-lambda-tesseract

How does it work?

This package contains an archive with Tesseract 4.0 beta compiled for usage in AWS Lambda environment.

When a Lambda starts, it unpacks an archive with a binary to the /tmp folder and makes sure it's done only once per Lambda cold start.

Usage

const {getTextFromImage, isSupportedFile} = require('@shelf/aws-lambda-tesseract');

module.exports.handler = async event => {
  // assuming there is a photo.jpg inside /tmp dir
  // original file will be deleted afterwards

  if (!isSupportedFile('/tmp/photo.jpg')) {
    return false;
  }

  return getTextFromImage('/tmp/photo.jpg');
};

isSupportedFile checks that file has image-like file extension and it's not in the list of unsupported by Tesseract file extensions.

Compile It Yourself

See compile-tesseract.sh & compress-with-brotli.sh files

See Also

License

MIT © Shelf

aws-lambda-tesseract's People

Contributors

renovate-bot avatar vladholubiev avatar vladgolubev avatar

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.