0:00
/
0:00
Transcript

Dall-E 3.0 Desktop Ui Python Script

Generate AI images on your desktop with this free Python script. Bypass throttling, batch create, and customize your DALL-E 3 experience. Get the code now.

Are you tired of the limitations and throttling of web-based AI image generators? I've got a solution for you! I created a desktop UI Python script that leverages the DALL-E 3 API, allowing you to generate images directly from your computer. This script is completely free, and I'm sharing the code with you. Read on to learn how it works and how to get it set up.
This is a re-post of a video tutorial I did, back in 2023, and the articles steps are adapted by an LLM from the video transcript, so it might not be exact.
Be sure to reference the video, above, for the exact steps.


Ivan David Lippens is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.


What This Script Does

This Python script provides a user-friendly desktop interface for creating images with DALL-E 3. Here's a breakdown of its features:

  • Image Size Options: Choose from horizontal, vertical, or square images.

  • Quality Selection: Generate standard or HD quality images.

  • Quantity Control: Specify the number of images you want to generate (up to a custom value).

  • API Key Storage: Securely stores your OpenAi API key so you don't have to enter it every time.

  • Progress Tracking: A progress bar indicates how far along the image generation process is.

  • Image Preview: Preview generated images within the UI.

  • Low Resource Usage: The script is designed to be lightweight, using minimal CPU and memory.

  • Error handling: The script saves the API to a text file to reference it for each use.

Why Use a Desktop Script?

  • Bypass Throttling: Avoid the frustrating limitations and wait times of web-based UIs.

  • Batch Generation: Easily generate multiple images at once, streamlining your workflow.

  • Convenience: Run image generation tasks in the background while you focus on other things.

Example: Interpreting the Prompt

Using a script like this pairs nicely with using Chat GPT to interpret the prompt. To do this, you can simply use the web UI for Chat GPT, paste an image into the window, and ask it to describe the image with as much detail as possible. Then you can use that detailed response for the script, and start generating images!

Step-by-Step Guide: Setting Up the Script

Follow these steps to get the script up and running on your system:

Prerequisites

  • An OpenAi API key. You'll need to create an account and obtain an API key from OpenAi.

  • A computer running Windows, macOS, or Linux.

  • A text editor (Notepad++, VS Code, etc.).

Step 1: Install Python

  1. Download the latest version of Python from python.org.

  2. Run the installer.

  3. Important: Make sure to check the box that says "Add Python to PATH" during installation.

  4. Optional: Enable admin privileges

Step 2: Install Required Python Packages

  1. Open a command prompt or terminal.

  2. Run the following command to install the necessary packages:
    pip install requests pillow openai
    If this command fails, try running python -m pip install requests pillow openai instead.

  3. If you get an error, you may have to upgrade the pip installation with the command that pops up in the window.

Step 3: Download and Prepare the Script

  1. Copy the script code from the Pastebin file linked, here.

  2. Create a new text file using your text editor.

  3. Paste the code into the text file.

  4. Save the file as dalle_desktop_ui.py (or any name you prefer, but make sure the extension is .py).

  5. Create a new folder for your images: image_output.

Step 4: Run the Script

  1. Open a command prompt or terminal.

  2. Navigate to the directory where you saved the script.

  3. Run the script by typing python dalle_desktop_ui.py and pressing Enter.

  4. You can also add the code to a text file on your desktop, and change the file extension from .txt to .py, and run it from there, like a shortcut, as it will render a user interface for you, to operate within.

Step 5: Configure the Script

  1. When the script runs, you'll be prompted to enter your OpenAi API key.

  2. Paste your API key into the designated field and click "Save API Key."

  3. Select the output folder where you want to save your generated images.

Step 6: Generate Images

  1. Enter your desired prompt in the prompt field.

  2. Adjust the image size, quality, and quantity settings.

  3. Click "Generate."

  4. Track the progress of the image generation using the progress bar.

  5. Preview the generated images in the UI or open the output folder to view them.

Modifying the Script

If you're comfortable with Python, you can customize the script to suit your specific needs. However, be aware that ChatGPT (specifically versions 3.0 and 3.5) may struggle to interpret and modify the entire codebase effectively. ChatGPT 4.0 has better functionality.
Also, you are welcome to paste the script into an LLM, and ask it if it’s safe. I didn’t put anything weird in there, and the code was fully developed by GPT, at the time, and should not require any updates. As long as they don’t deprecate the API functions, it should technically work forever.

Tips for Modification

  • The most effective way to modify this script is to modularize it into chunks to get it to do what you want. That’s the next step, for improving it, that I didn’t elect to mess with, at the time.

Conclusion

This desktop UI Python script offers a convenient and efficient way to generate AI images with DALL-E 3. I hope you find it useful.
Thanks for reading, don’t forget to subscribe, and if you’d like to see some of my use-cases, for this script, checkout my ministry project: KJV Cards.


Ivan David Lippens is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.

Get more from Ivan David Lippens in the Substack app
Available for iOS and Android

Discussion about this video