Custom Image Generator is a web-based application that allows users to generate images from textual descriptions using OpenAI's DALL-E model. The app is built using Flask for the backend and Bootstrap for the frontend. It leverages OpenAI's API to create AI-generated images based on user input and displays the generated image directly on the page.
- Generate images based on textual prompts.
- Simple and responsive UI.
- Displays generated images directly on the web page.
- Ability to copy the image URL to the clipboard.
Before you begin, ensure you have the following installed on your local machine:
- Python 3.x
- Flask
- OpenAI API Key
- boltiotai module for OpenAI integration.
-
Clone the repository:
git clone https://github.com/yourusername/Custom-Image-Generator.git cd Custom-Image-Generator
-
Install the required dependencies:
Install the dependencies specified:
pip install boltiotai
-
Set up your OpenAI API Key:
Export your OpenAI API key as an environment variable.
On Linux/macOS, run:
export OPENAI_API_KEY='your-openai-api-key'
On Windows:
cmd set OPENAI_API_KEY='your-openai-api-key'
-
Configure the OpenAI API:
In the Python script, make sure that the OpenAI API key is correctly imported from your environment variables:python openai.api_key = os.environ['OPENAI_API_KEY']
-
Running the Application:
Run the Flask application with the following command:
python app.py
By default, the app will run on localhost:8080. You can access it by navigating to:
- Once the app is running, open the URL in your browser.
- Enter a textual description (e.g., "A lion in a cage") in the input field.
- Click the "Share with the Image" button to generate an image.
- The image will be displayed on the page, and you can copy the image URL to your clipboard using the "Copy" button.
Contributions are welcomed!Fork the repo and submit a pull request with your changes.
This project demonstrates how to use OpenAI's DALL-E model with Flask to build a simple and interactive image generator. The app is extendable, and you can modify it to add more features or enhance the user interface. Feel free to contribute and make this project better!
This README.md provides all the essential details and instructions for users to set up, run, and contribute to your Custom Image Generator project.