257 lines
7.2 KiB
Markdown
257 lines
7.2 KiB
Markdown
# 10 prompts - 1000 AI generated images - openAI Dall-E
|
||
|
||
## Table of content
|
||
|
||
* <a href="#cats">1 - Cats</a>
|
||
* <a href="#robot">2 - Robot</a>
|
||
* <a href="#donut">3 - Donut</a>
|
||
* <a href="#dackel">4 - Dackel</a>
|
||
* <a href="#poster">5 - Poster</a>
|
||
* <a href="#citylife">6 - Citylife</a>
|
||
* <a href="#dolphin">7 - Dolphin</a>
|
||
* <a href="#light">8 - Light</a>
|
||
* <a href="#monster">9 - Monster</a>
|
||
* <a href="#cyberpunk">10 - Cyberpunk</a>
|
||
* <a href="#tech">Technical write-up</a>
|
||
|
||
## What is this all about?
|
||
|
||
We were curious about how much variance the AI has. So, what would be the results if we were to request 100 images with the same prompt? - I won't review the results and rather just present the results to you.
|
||
|
||
|
||
These **prompts** are a result of a quick **brain storming**. If you have suggestions, please let me know. I might create more posts like this in the future. The goal was to have a wide range to motives, styles, and so.
|
||
|
||
These **images are unedited**. Generated - downloaded - created a montage; that is it. **These images are free for personal or commercial use and do not require any form of mentioning**. [Dall-e](https://labs.openai.com/about) gives ownership of the images to me, and I give you permission to do with it, whatever you want.
|
||
|
||
The resolution of the originals is 1024x1024 and I might provide a download link at some point. If you want a single image, feel free to reach out.
|
||
|
||
With testing, the **total costs** were around **20 EUR**. I'd say that it is acceptable.
|
||
|
||
You can find a **technical write-up** at the end of the post. But as a disclaimer: not best-practice. Feedback is still appreciated.
|
||
|
||
|
||
# Gallery
|
||
|
||
**So, enjoy!**
|
||
|
||
## 1 - Cats <a href="#cats" id="cats">#</a>
|
||
|
||
> photo of a kitten on a carpet in the living room, digital art
|
||
|
||
<img src="/images/ai/1/montage_cats.jpg"
|
||
alt="cats"
|
||
style="width: 100%;">
|
||
|
||
---
|
||
|
||
## 2 - Robot <a href="#robot" id="robot">#</a>
|
||
|
||
> small robot wandering around in an post-apocalyptic world, digital art
|
||
|
||
<img src="/images/ai/1/montage_robot.jpg"
|
||
alt="robot"
|
||
style="width: 100%;">
|
||
|
||
---
|
||
|
||
## 3 - Donut <a href="#donut" id="donut">#</a>
|
||
|
||
> minimalist logo of a donut shop
|
||
|
||
<img src="/images/ai/1/montage_donut.jpg"
|
||
alt="donut"
|
||
style="width: 100%;">
|
||
|
||
---
|
||
|
||
## 4 - Dackel <a href="#dackel" id="dackel">#</a>
|
||
|
||
> dackel in a suit in a library, digital art
|
||
|
||
<img src="/images/ai/1/montage_dackel.jpg"
|
||
alt="dackel"
|
||
style="width: 100%;">
|
||
|
||
---
|
||
|
||
## 5 - Poster <a href="#poster" id="poster">#</a>
|
||
|
||
> movie poster for an action movie from the 80s, digital art
|
||
|
||
<img src="/images/ai/1/montage_poster.jpg"
|
||
alt="poster"
|
||
style="width: 100%;">
|
||
|
||
---
|
||
|
||
## 6 - Citylife <a href="#citylife" id="citylife">#</a>
|
||
|
||
> a black and white photo of the life in new york
|
||
|
||
<img src="/images/ai/1/montage_citylife.jpg"
|
||
alt="citylife"
|
||
style="width: 100%;">
|
||
|
||
---
|
||
|
||
## 7 - Dolphin <a href="#dolphin" id="dolphin">#</a>
|
||
|
||
> sticker illustration of a cute dolphin
|
||
|
||
<img src="/images/ai/1/montage_dolphin.jpg"
|
||
alt="dolphin"
|
||
style="width: 100%;">
|
||
|
||
---
|
||
|
||
## 8 - Light <a href="#light id="light">#</a>
|
||
|
||
> area view of a city with street lights at night, digital art
|
||
|
||
<img src="/images/ai/1/montage_light.jpg"
|
||
alt="light"
|
||
style="width: 100%;">
|
||
|
||
---
|
||
|
||
## 9 - Monster <a href="#monster" id="monster">#</a>
|
||
|
||
> detailed sketch of an evil monster, digital art
|
||
|
||
<img src="/images/ai/1/montage_monster.jpg"
|
||
alt="monster"
|
||
style="width: 100%;">
|
||
|
||
---
|
||
|
||
## 10 - Cyberpunk <a href="#cyberpunk" id="cyberpunk">#</a>
|
||
|
||
> realistic photo of a colorful cyberpunk city in the rain at night, digital art
|
||
|
||
<img src="/images/ai/1/montage_cyberpunk.jpg"
|
||
alt="cyberpunk"
|
||
style="width: 100%;">
|
||
|
||
---
|
||
|
||
|
||
## Tech write-up <a id="tech">#</a>
|
||
|
||
**Side note**: To be clear, this is not best-practice. It got its job done, and that is all I needed. Still, feel free to reach out, happy to learn!
|
||
|
||
First, openai Dall-E API offers to generate the following sizes, with 3 different prices:
|
||
|
||
```
|
||
Resolution Price
|
||
1024×1024 $0.020 / image
|
||
512×512 $0.018 / image
|
||
256×256 $0.016 / image
|
||
```
|
||
|
||
I've generated the largest resolution.
|
||
|
||
### Limitations
|
||
|
||
So, I've decided to use the API via curl, the first limit I encountered is the '10 images per request'.
|
||
|
||
```markdown
|
||
{
|
||
"error": {
|
||
"code": null,
|
||
"message": "20 is greater than the maximum of 10 - 'n'",
|
||
"param": null,
|
||
"type": "invalid_request_error"
|
||
}
|
||
}
|
||
```
|
||
|
||
The next one would be the rate limit of 50 images per 5 minutes.
|
||
|
||
```markdown
|
||
{
|
||
"error": {
|
||
"code": null,
|
||
"message": "Rate limit reached for images per minute. Limit: 50/5min. Current: 60/5min. Please visit https://help.openai.com/en/articles/68839691 to learn how to increase your rate limit.",
|
||
"param": null,
|
||
"type": "requests"
|
||
}
|
||
}
|
||
```
|
||
|
||
In the end, the download of the generated images was limited too. After every category I had to switch to another VPN server location to bypass the limit.
|
||
|
||
### Script to download them all!
|
||
|
||
I did a small break after every category to check the result of the script, and whether all images were generated and downloaded.
|
||
|
||
I'll add some comments later, but in short:
|
||
: generate images and put curl response to file
|
||
: get URL from output file and remove the quotation marks `"`
|
||
: download images via curl
|
||
: wait one minute to avoid rate limit
|
||
|
||
```bash
|
||
#!/bin/bash
|
||
|
||
# For for-loop for the whole script due to the limitations
|
||
# Curl request to generate the images via API, and the save the output via -o flag to a file
|
||
|
||
for i in {1..10};
|
||
do
|
||
echo $i
|
||
|
||
curl -o output.txt https://api.openai.com/v1/images/generations \
|
||
-H "Content-Type: application/json" \
|
||
-H "Authorization: Bearer sk-sdsdskdsdsdsdeefefe" \
|
||
-d '{
|
||
"prompt": "small robot wandering around in an post-apocalyptic world, digital art",
|
||
"n":10,
|
||
"size":"1024x1024"
|
||
}'
|
||
|
||
# Gets the URLs of the generate images, removes quotation marks, and saves it to a new file (one URL per line)
|
||
cat output.txt | jq '.data[].url' | sed 's/"//g' > output_url.txt
|
||
|
||
# Finally, download images with curl to the current directory. I was told that this is not bet practice, but it worked.
|
||
cat output_url.txt | while read f; do curl "${f}" -O; done;
|
||
|
||
# wait 60 seconds before we start it all over again
|
||
sleep 60
|
||
done
|
||
```
|
||
|
||
Things to improve: start/stop, logs, error and information notification, speed
|
||
|
||
### Rename everything
|
||
|
||
In the next step, I had to rename all the files. The file names were cryptic and difficult to work with.
|
||
|
||
```bash
|
||
#!/bin/bash
|
||
a=1
|
||
n=cats
|
||
for i in ./1_cats/*; do
|
||
new=$(printf "./1_cats/"$n"_%04d.jpg" "$a")
|
||
mv -i -- "$i" "$new"
|
||
let a=a+1
|
||
done
|
||
```
|
||
|
||
The name scheme would look like: `cats_0001.png`
|
||
|
||
### Create montage with imagemagick
|
||
|
||
In the last step, I used `imagemagick` to create a montage with the following command.
|
||
|
||
|
||
`montage -geometry 200x200+2+2 -tile 4x -set label '%f' *.jpg montag.jpg`
|
||
|
||
Explanation:
|
||
: `montage` *# imagemagick function to create montages*
|
||
: `-geometry 200x200+2+2` *# size per image + min size of the padding between the images*
|
||
: `-tile 4x` *# setting for the layout, 4 columns, unlimited rows. 3x4 would be a limit of 3 columns and 4 rows*
|
||
: `-set label '%f'` *# adds the filename of the image on the montage*
|
||
: `*.jpg` *# use ALL `.jpg` file within this directory for the montage*
|
||
: `montag.jpg` *# name and format of the final montage*
|
||
|
||
---
|