Deep Dream Javascript Examples

// Get the 'deepai' package here ( Compatible with browser & nodejs ) : // https://www.npmjs.com/package/deepai // All examples use JS async-await syntax, be sure to call the API inside an async function . // Learn more about async-await here: https://javascript.info/async-await // Example posting a image URL: const deepai = require ( 'deepai' ) ; // OR include deepai.min.js as a script tag in your HTML deepai.setApiKey ( 'YOUR_API_KEY' ) ; ( async function () { var resp = await deepai.callStandardApi ( "deepdream" , { image: "YOUR_IMAGE_URL" , }) ; console.log ( resp ) ; })() // Example posting file picker input image ( Browser only ) : const deepai = require ( 'deepai' ) ; // OR include deepai.min.js as a script tag in your HTML deepai.setApiKey ( 'YOUR_API_KEY' ) ; ( async function () { var resp = await deepai.callStandardApi ( "deepdream" , { image: document.getElementById ( 'yourFileInputId' ) , }) ; console.log ( resp ) ; })() // Example posting a local image file ( Node.js only ) : const fs = require ( 'fs' ) ; const deepai = require ( 'deepai' ) ; // OR include deepai.min.js as a script tag in your HTML deepai.setApiKey ( 'YOUR_API_KEY' ) ; ( async function () { var resp = await deepai.callStandardApi ( "deepdream" , { image: fs.createReadStream ( "/path/to/your/file.jpg" ) , }) ; console.log ( resp ) ; })()