Created
November 6, 2022 10:33
-
-
Save lorenzojkrl/2208f7394e0108490e91e131e64313d0 to your computer and use it in GitHub Desktop.
DALLE - Function for image generation app using openai API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const generateImage = async () => { | |
const imageParameters = { | |
prompt: userPrompt, | |
n: 1, | |
size: "256x256", | |
} | |
const response = await openai.createImage(imageParameters); | |
const urlData = response.data.data[0].url | |
console.log(urlData); | |
setImageUrl(urlData); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment