Is highly autonomous systems that outperform humans at most economically valuable work—benefits all of humanity.
Using this script it's possible to describe an image and the AI will create an image based on your description or use it to create texts, titles or own names. These text-to-image systems use a range of complex technology such as deep learning algorithms and generative adversarial networks (GANs)
All the buzz around the chat and everything it delivers. The bot has already been challenged with various questions, including music creation, poems, Enen essay. It has also been described as the "world's first truly useful chatbot". In another NY Times story , that OpenAI is winning digital art contests around the world. So to make OpenAI easier to use, I created a script in Python, using Typer to make the terminal more user-friendly and consuming the OpenAI API.
Let's start!
- python 3.8+ installed
- terminal to run commands
- IDE if you need to edit any code
- know how to clone this repo
Create virtual environment and install requirements
On Linux
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
On Windows
python -m venv venv
.\venv\Scripts\activate
pip install -r requirements.txt
To make successful calls to the Open AI API, you will need to register to Open API and create a new API Key by clicking on the dropdown menu on your profile and selecting View API key. Create a .env
file and copy to it: OPENAI_API_KEY="<your-key-value-here>"
After everything installed and set it's possible to start using it.
At the terminal, type: python main.py --help
and the output should be something like this:
Usage: main.py [OPTIONS]
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Customization and Utils ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --create TEXT Enter image for image creation or text for text creation. [default: Image] │
│ --description TEXT Enter here the description for your request, long descriptions are better than short ones. │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Great! The code is working and the command line is responsively, let's try to create some image.
At the terminal type: python main.py image "Space Opera Theater"
, wait for the outputs in the command line and check when the image has been saved: Image created at /... .png
You will win the digital image contest?