https://github.com/mrseanryan/gpt-images
Simple Python client to generate images from a word-list via Open AI (DAL-E)
https://github.com/mrseanryan/gpt-images
genai image-generation image-generation-ai image-generator-using-openai-api
Last synced: 7 months ago
JSON representation
Simple Python client to generate images from a word-list via Open AI (DAL-E)
- Host: GitHub
- URL: https://github.com/mrseanryan/gpt-images
- Owner: mrseanryan
- License: mit
- Created: 2023-08-07T08:08:16.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-20T19:36:16.000Z (over 1 year ago)
- Last Synced: 2025-01-20T20:32:03.628Z (over 1 year ago)
- Topics: genai, image-generation, image-generation-ai, image-generator-using-openai-api
- Language: Python
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gpt-images
Simple Python client to generate images from a word-list via Open AI (DAL-E)
## Dependencies
- Open-AI API key (for DAL-E)
- Python 3
- Unix or Mac OS (Windows may need some adaptation)
## Usage
1. Set up (see the Setup section)
2. Adjust [config.py](./config.py) to suit.
3. Edit the list of words at [./data/words_no_image.json](./data/words_no_image.json).
4. For **more abstract or complex words, the AI will need your help** to generate better images.
The **LLM's that generate the images have a limited vocabulary**, so words such as
'zabuton' or 'wadi' are not (currently) correctly recognised. Also some words are so abstract, even for a human it is difficult to depict as an image (consider 'depression' or 'friendship' or 'shibboleth').
Also, some words can trigger the safety features of the LLM, for example 'trauma' or 'gruesome'.
For such words, you can add a description to describe the image you would like to see, that represents the word, in the 'complex_words' section of the JSON file.
To set up the JSON structure, you can run `./add_complex_word_templates.sh`.
See the example at [./data/example.words_no_image.json](./data/example.words_no_image.json).
5. Run ./go.sh
OR:
```
python ./generate_images_from_words.py
```
6. Check the images at the output directory. By default this is [./output](./output).
- to retry: delete any images you do not like, and then run again.
- consider switching up to a better model (see [config.py](./config.py))
## Set up
0. Install Python and poetry
- Python 3.11
- [Poetry](https://python-poetry.org/docs/)
1. Install openai Python client.
```
poetry install
```
2. Get an Open AI key
3. Set environment variable with your OpenAI key:
```
export OPENAI_API_KEY="xxx"
```
Add that to your shell initializing script (`~/.zprofile` or similar)
Load in current terminal:
```
source ~/.zprofile
```
Setup is done.