Skip to content

abhishekrana/aws-serverless-image-to-text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

aws-serverless-image-to-text

Deploy image to text service using AWS Lambda function and SAM

Deploy on AWS

cd image-to-text
sam build
aws cloudformation delete-stack --stack-name image-to-text
sleep 10
sam deploy --stack-name image-to-text --guided

Deploy locally

cd image-to-text
sam build
sam local start-api --debug

Example

  1. Input image ./image-to-text/data/example.png

    example

  2. Convert input image to base64 encoding

    python3 image-to-text/app/encode.py

    This will generate image-to-text/data/example.json

  3. Deploy locally and test

    curl -X POST http://127.0.0.1:3000/image-to-text \
        -H "Content-Type: application/json" \
        --data "@image-to-text/data/example.json"

    Output

    {"message": "This is a lot of 12 point text to test the\nocr code and see if it works on all types\nof file format.\n\nThe quick brown dog jumped over the\nlazy fox. The quick brown dog jumped\nover the lazy fox. The quick brown dog\njumped over the lazy fox. The quick\nbrown dog jumped over the lazy fox.\n\f"}

Resources

Releases

No releases published

Packages

No packages published