aiastia-bak / dalle2-starter

Node-based starter application for interacting with Dall-E 2 (OpenAI) API in the browser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dall-E 2 Starter

Who is this for?

This starter application is for developers, artists or anyone routinely interacting with the Dall-E 2 API from OpenAI. It provides a quick and easy way to interact with the API through a web browser without needing to write code.

You can add your OpenAI API Key and request image generations, variations, or edits. You can manually adjust the generation quantity and resolution, and automatically save the resulting images locally.

Features

  • Access Dall-E 2 generation using API.
  • Generation, Variation, or Edit endpoints.
  • Generate images without corner logo.
  • Mask images for Edit endpoints in-browser using canvas editor.
  • Save image generations locally, automatically.
  • Adjust generation quantity and resolution.

Starting the server

# Clone repository
git clone https://github.com/darrylschaefer/dalle2-starter/ sampleproject

# Change directory
cd sampleproject

# Install dependencies
npm install

# Add API key to environment.env in root folder
OPENAI_API_KEY=""

# Start app
npm run build

# Open client
Start your internet browser, and type in the address: http://localhost:3000

Requesting Generations

To request image generations, visit http://localhost:3000 in your web browser after the server has started. Enter the desired prompt, resolution (default is 1024x1024), and quantity (default is 1), then click 'submit' to send the API request. If 'save locally' is checked (by default it is), the file will save to the /generations folder in the root of your application.

For image variations and edits, the image data is pulled from their respective canvas elements (set at 1024x1024). Make sure there's transparency if you're requesting an edit, you can make transparency using the eraser tool (example in video section).

Built using

  • Node / Express
  • Jade
  • TailwindCSS / Flowbite
  • Fabric.JS (canvas element)

Images / Video

About

Node-based starter application for interacting with Dall-E 2 (OpenAI) API in the browser.

License:MIT License


Languages

Language:CSS 51.8%Language:JavaScript 28.4%Language:Pug 19.8%Language:Shell 0.0%