XLR-8 AI Image Generator
This project lets you generate creative images based on textual prompts using the power of OpenAI's API and Cloudinary for image storage.
Features
- Generate unique images from text descriptions.
- Leverage OpenAI's advanced image generation capabilities (requires a paid OpenAI API key).
- Store and manage generated images using Cloudinary (separate signup required).
Prerequisites
- Node.js and npm (or yarn): Ensure you have these installed for project dependencies. You can download them from the official Node.js website (https://nodejs.org/en/download).
- OpenAI API Key: Sign up for an OpenAI account (https://openai.com/) and obtain an API key. Important: This project requires a paid OpenAI plan to access image generation functionality.
- Cloudinary Account: Create a free or paid Cloudinary account (https://cloudinary.com/) for image storage. You'll need your API key, secret, and cloud name for configuration.
Installation
-
Clone this repository:
git clone https://github.com/your-username/ai-image-generator.git
-
Navigate to the project directory:
cd ai-image-generator
-
Install dependencies:
npm install ``` (or `yarn install` if using yarn)
Configuration
-
Create a
.env
file in the project root directory (ignore this file in Git). -
Add the following environment variables to the
.env
file, replacing placeholders with your actual values:OPENAI_API_KEY=your_openai_api_key CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret
Usage
-
Start the development server:
npm start ``` (or `yarn start`)
-
Open http://localhost:3000 (or the port specified in your code) in your browser.
-
Enter a text prompt describing the image you want to generate.
-
Click the "Generate Image" button.
Generated Images
- Images will be stored in Cloudinary using the configuration you provided.
- The application UI may display the generated image or provide a link to it in Cloudinary.
Running in Production
- For deployment to a production environment, you'll need suitable hosting for your Node.js application. Make sure your environment variables are properly set on your production server.
- Consider security best practices, such as using environment variables to store API keys and secrets.
Disclaimer
- Note that this project requires a paid OpenAI plan to access image generation functionality. Free plans may have limitations.