All you have to do to adapt it for your case is upload your image to an S3 bucket. In my case that was “picostat.com” which is listed in the code above. You then change the name of the image to whatever your filename is then run it with this command:
The greater than tells Python to put the transcribed text in the file called bg.txt.
If you get an error message that boto is not installed you can install it on a Mac with this command:
To convert a large PDF (larged than 5 MB) you will need an asynchronous script:
Contents of rekog2.py
Once again, all you need to do is change the document name and the bucket name and then run this command.
If you’re not sure how to upload a document to S3 you can do it with this command if you have AWS CLI installed:
Or you can go to the AWS Console to use the graphical user interface uploaded in the S3 section.