You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenAI's DALL-E 2 is a machine learning model that generates images from textual descriptions. It is designed to be able to generate a wide range of images, from photorealistic to highly stylized, based on a given text prompt. DALL-E 2 is an updated version of the original DALL-E model, which was released in 2021.
import com.openai.api.Client
import com.openai.api.DALLEE2Model
import com.openai.api.model.v1.ImageCompletionRequest
import com.openai.api.model.v1.ImageCompletionResponse
fun generateImage(prompt: String) {
// Set the API key
val apiKey = "<api-key>"
// Set the model name and prompt
val model = "image-alpha-001"
val prompt = prompt
// Create the OpenAI client
val client = Client.builder(apiKey).build()
// Create the request object
val request = ImageCompletionRequest.builder()
.model(model)
.prompt(prompt)
.build()
// Send the request and get the response
val response: ImageCompletionResponse = client.imageCompletions().create(request)
// Print the response URL
println(response.getData()[0].getUrl())
// Close the client
client.close()
}
Try ChatGPT to generate illustrations for quiz categories
https://beta.openai.com/docs/guides/images/introduction
The text was updated successfully, but these errors were encountered: