/dalle-playground

The DALL-E Playground is a Streamlit app that allows users to generate AI-generated images using the Stable Diffusion model.

Primary LanguagePythonMIT LicenseMIT

DALL-E Playground

This repository contains a Streamlit app that allows you to generate AI-generated images using the Stable Diffusion model, similar to DALLE-2.

Installation

To run this application locally, please follow these steps:

  1. Clone this repository.
  2. Install the required dependencies by running pip install -r requirements.txt.
  3. Set up your OpenAI credentials by creating a .env file and adding your OPENAI_BASE and OPENAI_KEY.
  4. Run the Streamlit app with the command streamlit run streamlit_app.py.

Usage

Once you have set up and launched the application, you can use it to generate AI-generated images based on prompts.

  1. Enter your idea in the text input field provided.
  2. Click enter or submit.
  3. The app will generate a prompt based on your idea and display it along with an image generated by Stable Diffusion.

Example ideas:

  • Cat
  • Dog
  • Landscape with mountains
  • Abstract art

The generated image will be displayed along with its corresponding prompt.

Code Explanation

The code is divided into several parts:

  1. Importing necessary libraries and setting up environment variables using dotenv.
  2. Defining a template for generating prompts based on user ideas.
  3. Creating functions for making prompts and generating images using Stable Diffusion API calls.
  4. Setting up a Streamlit interface where users can enter their ideas, generate prompts, and view resulting images.

The main functionality lies within make_prompt() function which generates prompts using user-provided ideas, and stabble_difussion() function which generates images based on those prompts.

License

This project is licensed under the MIT license.

Acknowledgements

  • This application utilizes OpenAI's Stable Diffusion API.
  • Streamlit library was used to create the user interface.