Бұл жазба автоматты түрде аударылған. Бастапқы тіл: Ағылшын
Бұл мақалада мен мәтіндік сипаттамалардан керемет суреттер жасау үшін OpenAI-дің dall-E 3 моделін өз қосымшаңызда қалай жүзеге асыруға болатындығымен бөліскім келеді.
Төменде суретті жасайтын және сол кескінге сілтемені қайтаратын функция берілген.
жасалған кескіннің анықтамасы_текстен (сұрау, Өлшем, сапа, API кілті):
клиент = OpenAI (API кілті=api_key) # OpenAI API кілті https://openai.com/index/openai-api/
response = client.images.generate(
model=" dall-e-3", # кескін жасау моделі
prompt=шақыру, # кескін жасауға мәтіндік шақыру
size=өлшемі, # сурет өлшемі: 1024x1024, 1792x1024, 1024x1792
сапа = сапа, # жасалған кескін сапасы: стандартты, hd
n=1
)
return response.data[0].urlБағдарламаның қалай жұмыс істейтінін көрсету үшін біз қарапайым веб-қосымшаны жасадық, төменде сіз бағдарламаны жүктей аласыз, оны өзіңіз тексеріп, жобаларыңызда қолдана аласыз.
Жобаға сілтеме: https://github.com/Dataflow-kz/streamlit-ai-apps/tree/main/text-to-image-generator-app
- Streamlit;
- OpenAI (DALL-E 3);
- Сұраулар;
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;