Flask app to generate images with the OpenAI DALL·E Images API.
- DALL·E Images API creates images from a text prompt
- Flask a python web framework
- Uses the Jinja template engine
- Flask-SQLAlchemy, which simplifies SQLAlchemy for Flask
- SQLAlchemy is an SQL toolkit and Object-Relational Mapper for Python
- Connects to a SQLite database
- Flask Migrate to configure Alembic for Flask-SQLAlchemy
- Alembic is a lightweight database migration tool for SQLAlchemy
- Fork art-generated
- Create a local clone of the forked repository
- Using the terminal, move into your local copy
cd art-generated
🚨 Flask installed globally can cause 'Module not found' errors inside the venv. Consider
pip3 uninstall flask
- Create a virtual environment
MacOS/Linux
python3 -m venv venv
. venv/bin/activate
Windows
py -3 -m venv venv
venv\Scripts\activate
- Install dependencies
pip3 install -r requirements.txt
- Rename .env-copy to .env
mv .env-copy .env
- Create an OpenAI account and fill in .env
OPENAI_API_KEY='<your api key>'
OPENAI_ORG_ID='<your organization>'
- Create initial database migration
flask db init
flask db migrate -m "Initial migration."
When changes are made to the database model, run
flask db upgrade
1
- Run the app
flask --debug run
- Generate images on the browser! 🎉