Closed CreativeHazio closed 1 year ago
0.8.1 doesn't, but that's actually a great feature request. You could do BodyHandlers.ofInputStream() and then pipe it into import javax.imageio.ImageIO; Let me see if I can get my current Stable-Diffusion code (in Java) to work w/ the Dall-E-2 api and post it.
https://beta.openai.com/docs/guides/images
https://api.openai.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"prompt": "a photo of a happy corgi puppy sitting and facing forward, studio light, longshot",
"n":1,
"size":"1024x1024"
}'
This should be easy.
Example POST on https://api.openai.com/v1/images/generations with json body.
{
"prompt": "a great white shark on a surfboard, big wave, photograph",
"n": 1,
"size": "1024x1024"
}
Example result:
{
"created": 1672246953,
"data": [
{
"url": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-H8M9BzcDhaUlaAvTZ6sevaU7/user-hSKowdY4rbgEAYVbJNf5D6GH/img-hE68jf1MJDYeI41FvKWPyqt7.png?st=2022-12-28T16%3A02%3A33Z&se=2022-12-28T18%3A02%3A33Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2022-12-28T15%3A22%3A22Z&ske=2022-12-29T15%3A22%3A22Z&sks=b&skv=2021-08-06&sig=hb69P59VJA3y9Zoib7i53g8rsyQOmG2XrSgLBekxIPk%3D"
}
]
}
And the actual pic in case anyone wants to see it. :-) https://oaidalleapiprodscus.blob.core.windows.net/private/org-H8M9BzcDhaUlaAvTZ6sevaU7/user-hSKowdY4rbgEAYVbJNf5D6GH/img-hE68jf1MJDYeI41FvKWPyqt7.png?st=2022-12-28T16%3A02%3A33Z&se=2022-12-28T18%3A02%3A33Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2022-12-28T15%3A22%3A22Z&ske=2022-12-29T15%3A22%3A22Z&sks=b&skv=2021-08-06&sig=hb69P59VJA3y9Zoib7i53g8rsyQOmG2XrSgLBekxIPk%3D
Thanks a whole lot, i would try it now
This will be included in the next release :+1:
Does this Api generate images?