jasonfilippou / AWS-Flask

An EC2-hosted Python Flask application that allows users to upload images and have labels automatically generated

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS-Flask

Description

A Flask app that allows a user to upload images and automatically generate meaningful labels. The app runs on an EC2 cluster and makes use of the boto3 library to leverage several AWS services, authentication & authorization, image recognition and label generation, queueing, distributed computation and storage of binary and relational data. Inspired by the edx.org course AWS Fundamentals.

AWS services leveraged:

  • EC2, for deployment of web servers and load balancer on appropriate availability zones.
  • S3, for storage of binary images.
  • RDS, for storage of image labels generated by Rekognition.
  • Rekognition, for detecting key points in images and generating meaningful labels.
  • Cognito, for authorization and authentication.
  • SQS, for queueing image upload requests.
  • Lambda, to make the image recognition component asynchronous and avoid having the frontend "hang" on the user.

Contents

  • Deploy: scripts to initialize the environment for the entire application. Since the application is run on an EC2 "free" allocation, we frequently terminate and restart EC2 and RDS services. The scripts in this directory allow a fresh EC2-hosted OS to download some necessary packets and initialize nginx appropriately.
  • SetupScripts: A Python function that sets up the RDS database needed to store image labels.
  • FlaskApp: In many ways the "meat" of the project, especially application.py. The reader is encouraged to read through the comments ofapplication.py for an explanation of the flow of a user request through the various routes that the app listens to. Additional Python files exist, for storing sensitive information (e.g Cognito access keys / secrets) in environment variables, and for wrapping around SQL queries.
  • LambdaImageLabels: Contains code that would otherwise be in FlaskApp/application.py, such that Amazon Lambda can use the Rekognition routines outside the EC2 server and asynchronously return the results to the user.
  • SqsLongPoll: implementation of a long polling function for receiving notifications of image uploads from S3.

LICENSE

Refer to the comments in the individual source files for details.

About

An EC2-hosted Python Flask application that allows users to upload images and have labels automatically generated


Languages

Language:Python 89.0%Language:HTML 8.4%Language:Shell 2.2%Language:CSS 0.3%