Giter Club home page Giter Club logo

aws-lambda-tesseract's People

Contributors

dianakryskuw avatar drewsabuse avatar knupman avatar renovate-bot avatar renovate[bot] avatar terret avatar vladgolubev avatar vladholubiev avatar yuriilevantovych avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-lambda-tesseract's Issues

Cannot read input file from /tmp/

I'm very inexperienced with Lambda functions so apologies if this is a basic error.

I have a very simple Node app with the following structure:

index.js
tmp/demo.png

I added the demo code into index.js:

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

exports.handler = async event => {
    console.log("Running...");

    const imagePath = "/tmp/demo.png";

    if(isSupportedFile(imagePath)) {
        console.log(`${imagePath} is supported`)
    } else {
        return false;
    }

    return getTextFromImage(imagePath);
};

However, when I run the Lambda it errors:

Response:
{
  "errorType": "Error",
  "errorMessage": "Command failed: /tmp/tesseract-standalone/tesseract /tmp/demo.png stdout -l eng\nError, cannot read input file /tmp/demo.png: No such file or directory\nError during processing.\n",
  "trace": [
    "Error: Command failed: /tmp/tesseract-standalone/tesseract /tmp/demo.png stdout -l eng",
    "Error, cannot read input file /tmp/demo.png: No such file or directory",
    "Error during processing.",
    "",
    "    at checkExecSyncError (child_process.js:630:11)",
    "    at execFileSync (child_process.js:648:15)",
    "    at module.exports.getTextFromImage (/opt/nodejs/node_modules/@shelf/aws-lambda-tesseract/src/index.js:19:18)"
  ]
}

Why can't the Lambda find the image in my tmp folder?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

circleci
.circleci/config.yml
  • node 5.1.0
  • aws-cli 3.1.4
npm
package.json
  • is-image 3.1.0
  • tar 6.1.13
  • @babel/cli 7.20.7
  • @babel/core 7.20.12
  • @babel/preset-env 7.20.2
  • @babel/preset-typescript 7.18.6
  • @shelf/babel-config 1.2.0
  • @shelf/eslint-config 2.27.1
  • @shelf/prettier-config 1.0.0
  • @types/jest 29.4.0
  • @types/tar 6.1.3
  • eslint 8.33.0
  • husky 8.0.3
  • jest 29.4.1
  • lint-staged 13.1.0
  • prettier 2.8.3
  • typescript 4.9.4
  • node >=16

  • Check this box to trigger a request for Renovate to run again on this repository

Option to set tesseract parameters?

Hi forks,
Thanks for a very useful library :)

I think it will be a big improvement if we support sending tesseract parameters such as:

getTextFromImage(image, {
   tessedit_char_whitelist: "123456789" // number only
})

What do you think?

Set output types

Hi, can you add the option for output types please? Could look something like this:
`async function getTextFromImage(filePath, outputType) {
await (0, _tar.extract)({
file: inputPath,
cwd: '/tmp'
});

if (outputType !== 'stdout' || outputType !== 'txt' || outputType !== 'pdf'|| outputType !== 'hocr'|| outputType !== 'tsv') {
return "BAD_OUTPUT_TYPE"
}

const stdout = (0, _child_process.execFileSync)(outputPath, [filePath, outputType, '-l', 'eng'], {
cwd: '/tmp/tesseract-standalone',
env: {
LD_LIBRARY_PATH: './lib',
TESSDATA_PREFIX: './tessdata'
}
});
(0, _child_process.execSync)(rm ${filePath});
return stdout.toString();
}`

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>shelfio/renovate-config)

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.