Skip to content

wobsoriano/node-dalle

Repository files navigation

node-dalle

AI model drawing images for Node using min(DALL·E). Requires python3.

Installation

npm install dalle

Sometimes you have to install prerequisites to make it work. Check below:

Linux

Install Python

sudo apt install python3
sudo apt install python3-dev

Install Node-gyp

sudo apt install make
sudo apt install g++
sudo npm install -g node-gyp
Windows

Install Python, Node-gyp if missing

npm install --global --production windows-build-tools
npm install -g node-gyp
Mac

Install XCode from AppStore, Python

Usage

import { generateImage } from 'dalle'
import ImageDataURI from 'image-data-uri'

async function start() {
  const dataURI = await generateImage('Nuclear explosion broccoli', { gridSize: 2 })
  ImageDataURI.outputFile(dataURI, 'brocolli.png')
}

start()

The generateImage function will load the model parameters once and reuse the model to generate multiple images.

License

MIT License © 2022 Robert Soriano