Skip to content

Flag poster that are not in semantic compliance with custom policies using Gen AI.

Notifications You must be signed in to change notification settings

maxtybar/gen-ai-movie-poster-moderator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Caution

Due to AWS sunsetting the AWS CodeCommit service this solution will fail to be deployed. CodeCommit can be substituted by an Amazon S3 bucket. This solution is currently being reworked and will be updated soon.

Gen AI Movie Poster Moderator

Flag poster that are not in semantic compliance with custom policies using Gen AI.

Media companies want to review movie posters for specific markets for compliance before they publish them. For example, in China movie posters should not show bones. These moderation requirements need to be customizable and should not require additional training. Gen AI Movie Poster Moderator takes a movie poster and evaluates it for customizable and nuanced conditions. It can detect nuances like sharks vs sharks eating humans. If a condition fails it flags the poster and provides the reason why it failed.

Gradio Workflow

Services and technologies used

Architecture

gen-ai-movie-poster-moderator architecture

Prerequisites

Deployment has been tested on MacOS, Windowsa and Linux machines. Installation guide assumes you have AWS account and Administrator Access to provision all the resources. Make sure you have access to Anthropic's Claude 3 Sonnet model on Amazon Bedrock and your credentials stored in ~/.aws/credentials (MacOS) or C:\Users\username\.aws\credentials (Windows).

=============

Deployment

Clone current repository:

git clone https://github.com/maxtybar/gen-ai-movie-poster-moderator.git

Navigate to the cloned repository in your terminal/shell and then cd into deploy folder. All of the commands are to be executed from this folder.

npm install

Note - if you have npm ERR! erros related to overlapping dependencies, run npm install --force.

If this is your first time deploying infrastructure using AWS CDK for the particular account, bootstrap it first with the following command:

cdk bootstrap

Important

Think about a username and password and save it in local environment variables. You will use this username and password to authenticate in the Gradio app later on.

Substitute <> fields with your username and password and execute this command in the terminal/command line:

GRADIO_USERNAME=<your username>
GRADIO_PASSWORD=<your password>

Deploy the infrastructure:

cdk deploy --require-approval never -c gradioUsername=$GRADIO_USERNAME -c gradioPassword=$GRADIO_PASSWORD

It will take somewhere from 5 to 7 minutes for the infrastructure to be deployed. Note the URL for the application load balancer in the terminal output. It will be in the following form:

GenAIMoviePosterModeratorStack.fargateConstructServiceService{random_prefix} = http://gen-ai-movie-poster-lb-{random_prefix}{your_region}.elb.amazonaws.com

Please wait another 4-5 minutes for the CodePipeline to build a Docker image and then deploy it to the Fargate container. After that, navigate to the URL that you copied in the previous step and authenticate using your username and password. Here is the screen you will see:

Login

After you log in you will get to the main page:

Main page

Test out using preuploaded images or upload one of yours.

Conclusion

Feel free to modify prompt sent to the Claude 3 Sonnet model by modyfing it in the app.py file. Enjoy!

How to delete

To stop incurring any charges, from within the deploy folder, run the following command:

cdk destroy --force -c gradioUsername=$GRADIO_USERNAME -c gradioPassword=$GRADIO_PASSWORD 

The deletion will take somewhere from 7 to 8 minutes.

About

Flag poster that are not in semantic compliance with custom policies using Gen AI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published