DEV Community

Cover image for Fun Project for getting started with AI: Rekognition DetectText
Veliswa_Boya 🇿🇦 for AWS Heroes

Posted on • Edited on

8 2

Fun Project for getting started with AI: Rekognition DetectText

AWS offers a comprehensive set of services and APIs for Artificial Intelligence and Machine Learning.
What's awesome about this is that this set of services caters for both customers without ML skills and those looking for advanced functions.

I recently created an application that uses the Rekognition DetectText API.
Rekognition offers Image and Video APIs. The following Image APIs are available:

- Labels
- Custom Labels
- Content Moderation
- Face Detection and Analysis
- Face search and verification
- Celebrity Recognition
- Personal Protective Equipment (PPE) detection
- Text detection 
Enter fullscreen mode Exit fullscreen mode

I recently created what would be a back-end of an application that receives images which contain text. The back-end (Python) calls the Rekognition DetectText API which extracts the text, receives the extracted text and concatenates this text into a string. The string is then published to an SNS topic as a message where all those subscribed will receive this message.

The Architecture Design of the solution

Alt Text

SNS Topic: Create a topic accordingly, with the relevant subscriptions

S3 Bucket: Create an S3 bucket and grant the necessary permission.
If there needs to be public access, allow this through
the access control lists (ACLs), bucket policies, access point policies, etc.

Alt Text

Lambda Function: modify the Basic Lambda Execution role to include the following policies (in addition to the default policy assigned at role creation):
AmazonRekognitionReadOnlyAccess
AmazonS3ReadOnlyAccess
AmazonSNSFullAccess

Alt Text

Lastly, include the following resource-based policy, so that S3 can trigger the Lambda on PutObject of the image:

Alt Text

The complete code is available in my github repository and the sample is as below:

Alt Text

Conclusion

I hope this gets you started on AWS AI if you haven't already - and that you find your own use cases that will have you build even more fun (or useful :)) AI applications.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post