Project Setup
-
Create a virtual environment.
python3 -m venv venv
-
Activate the environment.
source venv/bin/activate
-
Install flask
pip install flask
-
Install openai.
pip install openai
-
Obtain an API Key from OpenAI: https://platform.openai.com/account/api-keys
-
Put your API key into the file
instance/openai-config.json
like so:
{
"OPENAI_API_KEY": "MY_API_KEY"
}
Local Setup
-
Load the python virtual environment.
source bin/activate
-
Run the server locally.
flask --app flaskr --debug run
-
Visit the server at http://127.0.0.1:5000/
Deployment on AWS
The deployment of this app is based on AWS Elastic Beanstalk and follows the method outlined in the online tutorial.
- Install the AWS Elastic Beanstalk command-line tool following these instructions: https://github.com/aws/aws-elastic-beanstalk-cli-setup
- Configure the
eb
tool for your AWS account.