https://github.com/heyfoz/python-dalle3-local
Python script utilizing OpenAI's DALL-E 3 API to generate images with AI from text prompts. It includes user input handling and returns generated image URLs.
https://github.com/heyfoz/python-dalle3-local
api dalle-3 environment-variables openai os python
Last synced: 3 months ago
JSON representation
Python script utilizing OpenAI's DALL-E 3 API to generate images with AI from text prompts. It includes user input handling and returns generated image URLs.
- Host: GitHub
- URL: https://github.com/heyfoz/python-dalle3-local
- Owner: heyfoz
- License: mit
- Created: 2024-01-12T20:31:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-17T22:58:14.000Z (over 1 year ago)
- Last Synced: 2024-09-12T00:13:00.923Z (about 1 year ago)
- Topics: api, dalle-3, environment-variables, openai, os, python
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DALL-E 3 Image Generator Script
This Python script allows users to interact with OpenAI's DALL-E 3 API to generate images based on text prompts. It prompts the user to enter some text, submits this text to the DALL-E 3 model, and if successful, returns the URL of the requested image.
**NOTE**: OpenAI API documentation may change in the future. For the most current information, visit the official [OpenAI site for developers](https://platform.openai.com/docs/guides/images/introduction).
## Important Note
The images generated by the DALL-E 3 API are typically available for a short period of time, approximately 1 hour, before they are no longer accessible via the URL.## Authentication
The script requires an API key from OpenAI for authentication. Before running the script, set up an environment variable `OPENAI_API_KEY` with your OpenAI API key. Retrieve your API key from your [API Keys page on OpenAI](https://platform.openai.com/account/api-keys).For assistance on setting up environment variables:
- On Windows, follow Microsoft's guide on [Environment Variables](https://learn.microsoft.com/en-us/windows/win32/procthread/environment-variables).
- On Linux/Unix, refer to the guide on [setting environment variables in Linux](https://linuxize.com/post/how-to-set-and-list-environment-variables-in-linux/).## Features
- Interactive prompt for user input.
- Integration with OpenAI's DALL-E 3 API.
- Returns the URL of the generated image based on the user's text input.## Prerequisites
Before running this script, ensure you have the following installed:
- Python (3.x or above)
- `requests` library for Python (for making HTTP requests)
- An API key from OpenAI for DALL-E 3 access## Installation
1. Install Python from [Python's official website](https://www.python.org/downloads/).
2. Install the `requests` library using:
`pip install requests`
4. Set up an environment variable `OPENAI_API_KEY` with your OpenAI API key.## Usage
Run the script in a Python environment. Follow the interactive prompts to enter your text for image generation and receive the image URL.
## OpenAI DALL-E 3 API Documentation
For more details about the DALL-E 3 API and its capabilities, please refer to the official [OpenAI DALL-E 3 API documentation](https://platform.openai.com/docs/guides/images/introduction).
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/ffm5113/python_dalle3_local/blob/main/LICENSE) file for details.