Skip to main content

Python script for generating image from text by Open AI

Project description

openai_image

Python script for generating image from text by Open AI

openai_image

1. Install openai & openai-image

pip install openai


pip install openai-image

2. Recieve your OpenAI API KEY

https://platform.openai.com/account/api-keys

create file settings.py in your folder/

put this key to settings.py file

API_KEY = 'your-secret-openai-api-key'

3. Set image size

settings.py:

PIC_SIZE = '256x256'

(options :'256x256', '512x512', '1024x1024')

4. Mkdir images

Create folder 'images' (foder for ready images)

5. Use openai_image

import openai_image

Example1:

import openai_image

openai_image.get_image()

Prompt target text: blue bird

openai_image blue bird

Your image file ready: /images/blue_bird.jpg

Example2:

import openai_image

openai_image.get_image('Alice in Wonderland')

openai image Alice in Wonderland

Your image file ready: /images/Alice_in_Wonderland.jpg

Documentation

https://best-itpro.ru/news/openai_image/

That's All, Folks! ;)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openai-image-1.0.4.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

openai_image-1.0.4-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page