/generative-stalagmite

Repository containing code used in the 2023 theatre performance for HaDivadlo

Primary LanguagePythonMIT LicenseMIT

generative-stalagmite

This uses the Flask web framework.

Setup

  1. If you don’t have Python installed, install it from here.

  2. Clone this repository.

  3. Navigate into the project directory:

    $ cd generative-stalagmite
  4. Create a new virtual environment:

    Linux:

    $ python -m venv venv
  5. Activate the environment

    Linux:

    $ . venv/bin/activate

    Windows:

    > .\venv\Scripts\activate
  6. Install the requirements:

    $ pip install -r requirements.txt
    $ pip install --upgrade openai
  7. Make a copy of the example environment variables file:

    $ cp .env.example .env
  8. Add your API key to the newly created .env file.

  9. Run the app:

    $ flask run

Now go to http://localhost:5000/stalagmite ! Each load of the page will generate a new stalagmite.

In order to batch create images, go to http://localhost:5000/stalagmiteBatch?prompt=stalagmite&num=4. num is the number of images you want to create. OpenAPI support up to 10 images per request, so if you request more than 10, it will be divided into multiple requests. All the retrieved images will be stored in a folder named with current date in PNG format.

Parameters

You can modify several parameters of this app in the .env file.

RESOLUTION=1024 Sets the horizontal and vertical resolution of the output image. Allowed values are 256,512 and 1024.