Skip to content

create a live ML demo using AWS Rekognition, App Runner and FastAPI

Notifications You must be signed in to change notification settings

fraukecharms/fastapi-rekognition-compvision

Repository files navigation

Github Actions Badge

Create an Object Detection Demo

You can use this repo to quickly create a live public(!) demo website for object detection. The prediction requests are sent to AWS' built-in Rekognition service. If you are looking for a solution that sends requests to your own Sagemaker endpoint, check out this repo instead.

Before You Start

Make sure that you do all your work in a region where App Runner is available (e.g. eu-west-1 if you are based in Europe).

Walk-Through Screen Recording

Here is an example of setting up a Cloud9 environment for your repo. Once that is up and running, feel free to follow along here:

Object Detection Demo (via FastAPI, AWS App Runner & Rekognition)

Docker Instructions

docker build --tag visiondemo-rekognition .
docker run -p 127.0.0.1:8080:8080 -v $HOME/.aws/:/root/.aws:ro -e \
    AWS_PROFILE=default visiondemo-rekognition

Push to ECR

Screenshot 2022-11-07 at 10 15 38

App Runner Permissions

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "tasks.apprunner.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

(Optional) Run without Docker

make install
python main.py

(Optional) Automated Testing with Github Actions

If you are interested in automated testing, check out the main.yml file in .github/workflows/. You can set this up by configuring OpenID Connect in AWS and creating an IAM role for your repo. You can read more about it here and here. However, this is optional and not required for the demo to work.

Learning Material

About

create a live ML demo using AWS Rekognition, App Runner and FastAPI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published