This is a local frontend client that consumes the OpenAI Dalle-2 to generate an image from a prompt. It was built using React and Vite.
To run this project, you need to follow these steps:
- Clone the repository locally
- Install the dependencies by running
yarn
- Rename the file
.example.env
to.env
- Open
.env
and add your OpenAI API key - Run the project locally by running
yarn dev
This project has two pages:
-
Generate Image: This page allows you to generate a single image based on a prompt. Simply enter your prompt and click on the "Generate" button. The image will be displayed on the screen.
-
Gallery: This page displays a gallery of all the previously generated images. The images and their corresponding prompts are stored locally using local storage.
PS: Keep in mind that the local storage only stores the URL of the image coming from the OpenAI API. These URLs are signed with a time to live of 1 hour.
If you use Dalle on OpenAI labs, after the free tier you will have to pay for credits to generate images.
The minimum amount of credits you can buy is 115 for $15, which will give you 460 images as each credit generates 4 images.
If you use the API directly, you can generate 750 images for $15 as the price is $0.02 per image (1024x1024).
That's a 64% discount!
If you would like to contribute to this project, please follow these steps:
- Fork the repository
- Create a new branch for your changes
- Make your changes and commit them
- Push your changes to your fork
- Submit a pull request
This project is licensed under the MIT License.