Mark's Tiny Project - AWS Rekognition REST api via Java Spring
Description:
The reason for creating this REST api is to develop an endpoint to hit in order to process an image for text. The inspiration behind this is that I want to be able to create a website so users can submit photos of a scoreboard within a game such as Rainbow Six Siege or Call of Duty: Multiplayer to then get back the stats for each player. The way this would work is once the image is submitted, AWS Rekognition grabs the text of the usernames, then I would then hit an offical or unoffical endpoint from the frontend to then grab data on the user's favorite operators, characters or favorite guns. After doing some research the documentation was spotty in regards to creating a api call via JavaScript for AWS Rekognition, so I decided to utilize my knowledge of Spring and Java to get the endpoint up and running quickly. So after a little trial and error I was able to successfully create the endpoint and tested it via Postman!
Cost to setup
Total Cost: $0.00
Tool kit
- ATOM - Text Editor
- Eclipse - IDE
- Openjdk - Java 8
- Spring - Java framework
- Gradle - Build Tool
- spring initializr - API to generate JVM-based projects * LIFE SAVOR - Makes building spring java projects so easy
- Postman - API testing/development platform
- AWS Rekognition - ML/Deep Learning Technology
Code
I included the code and build dependencies below so that others can use this code to get up and running quickly. I got the original example from AWS, but the code below has been modified to include how to set up the REST API call with a MultipartFile input and how to read the file as a ByteBuffer. In addition, it also includes how to call the DetectTextRequest function with a local image not stored on an S3 bucket.