'Serendipi-art' originated from a lack of creative juice and is short for 'serendipitious art'. Serendipi-art determinstically generates a Voronoi image with a random caption by providing it with a seed value. The image is captioned using OpenAI's GPT-3 davinci-instruct-beta-v3 model, with the caption randomly generated by giving the model the following prompt:
This is an image name generator
- Colourful Shapes
- Light All Over
- Voronoi Masterpiece
- Lucid Dreams
- Naughty by Nature
- Bad and Beyond
- Rainbow Rain
As seen above, point 8 is left intentionally blank as that point will be autocompleted by OpenAI. Pretty cool.
We give OpenAI some examples of image names and it's able to complete our list with a name that could possibly fit in our list. For example, an OpenAI response could look like:
- Ominous Fog
Seed = 220492 | Seed = 200495 |
---|---|
$ git clone https://github.com/tobiade/serendipi-art.git
$ cd serendipi-art # go into the serendipi-art folder
$ pip install -r requirements.txt # install dependencies
Firstly, you'll need to get an API key from OpenAI to utilise the OpenAI model. You can do this by creating an account and grabbing your API key from here.
You can then set environment variables by creating a .env
file (a file named .env
) in the serendipi-art directory like so:
# Flask
FLASK_APP=serendipiart
FLASK_ENV=development
# OpenAI
OPENAI_API_KEY={Insert your API key}
or you could set them in your shell like so:
$ export FLASK_APP=serendipiart
$ export FLASK_ENV=development
$ export OPENAI_API_KEY={Insert your API key}
$ flask run
Visit http://127.0.0.1:5000/art/{seed value} e.g http://127.0.0.1:5000/art/111023. A different number will generate a different Voronoi image.