The post has been translated automatically. Original language: English
In this article, I want to share how you can implement the DALL-E 3 model from OpenAI in your own application to create stunning images from text descriptions.
Below is a function that generates an image and returns a link to that image.
definition of the generated image from the text(request, size, quality, api key):
client = OpenAI(api key=api_key) # OpenAI API key from https://openai.com/index/openai-api/
response = client.images.generate(
model="dall-e-3", # the model for creating the image
prompt=invitation, # text invitation to create an image
size=size, # image size: 1024x 1024, 1792x 1024, 1024
x 1792 quality = quality, # generated image quality: standard, hd
n=1
)
return response.data[0].urlTo demonstrate how the program works, we have created a simple web application. Below you can download the program, test it on yourself and use it in your projects.
Link to the project: https://github.com/Dataflow-kz/streamlit-ai-apps/tree/main/text-to-image-generator-app
- Streamlit;
- Open Up (DALL-E 3);
- Requests;
In this article, I want to share how you can implement the DALL-E 3 model from OpenAI in your own application to create stunning images from text descriptions.
Below is a function that generates an image and returns a link to that image.
definition of the generated image from the text(request, size, quality, api key):
client = OpenAI(api key=api_key) # OpenAI API key from https://openai.com/index/openai-api/
response = client.images.generate(
model="dall-e-3", # the model for creating the image
prompt=invitation, # text invitation to create an image
size=size, # image size: 1024x 1024, 1792x 1024, 1024
x 1792 quality = quality, # generated image quality: standard, hd
n=1
)
return response.data[0].urlTo demonstrate how the program works, we have created a simple web application. Below you can download the program, test it on yourself and use it in your projects.
Link to the project: https://github.com/Dataflow-kz/streamlit-ai-apps/tree/main/text-to-image-generator-app
- Streamlit;
- Open Up (DALL-E 3);
- Requests;