AI model drawing images for Node using min(DALL·E). Requires python3.
npm install dalle
Sometimes you have to install prerequisites to make it work. Check below:
Linux
sudo apt install python3
sudo apt install python3-dev
sudo apt install make
sudo apt install g++
sudo npm install -g node-gyp
Windows
npm install --global --production windows-build-tools
npm install -g node-gyp
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.
MIT License © 2022 Robert Soriano