Open Nodrex opened 1 year ago
1) openai is not what we wont at this moment, it generates images using ai and quality is poor. 2) unsplash.com has limitation 50 request in one hour. also search result is not setistaiting 3) now researching https://www.flickr.com/ api
@kdiakonidze https://openai.com/dall-e-2/ try also this, it is free and good as I know
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