This is a telegram bot that uses AWS Rekognition to detect emotions on selfies.
- If you don't have an AWS Account - create it now
- Install AWS CLI
- Configure CLI by running
aws configure
and enter your credentials (manual here)
This works for Python>=3.7.
pip install -r requirements.txt
or:
poetry install
The app needs a DynamoDB table and an S3 bucket with unique names. Create these names by running:
flask prepare
flask createdb
This will create an .env
file in your app directory with required variables and create AWS resources.
Run:
zappa deploy dev
You will get some console output. Most important two lines are:
Waiting for stack serverless-reko-dev to create (this can take a bit)..
...
Your updated Zappa deployment is live!: https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev
- From the first line, remember the function name:
serverless-reko-dev
- From the last line, remember the endpoint:
https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev
Open the .env
file in the app folder and add two variables from above:
LAMBDA_FUNCTION_NAME=serverless-reko-dev
LAMBDA_ENDPOINT=https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev
Create a Telegram bot like this
Add bot token to .env
file:
...
TELEGRAM_TOKEN=your-telegram-token
Run commands:
flask connect-bot
Now send some selfies to your chatbot. It should be able to reply.
If you want to delete everything, you need to do two things:
- To undeploy your app, run:
zappa undeploy dev
- To drop the DynamoDB table and S3 bucket with photos, run
flask dropdb
.