This repository contains a Streamlit app that allows you to generate AI-generated images using the Stable Diffusion model, similar to DALLE-2.
To run this application locally, please follow these steps:
- Clone this repository.
- Install the required dependencies by running
pip install -r requirements.txt
. - Set up your OpenAI credentials by creating a
.env
file and adding yourOPENAI_BASE
andOPENAI_KEY
. - Run the Streamlit app with the command
streamlit run streamlit_app.py
.
Once you have set up and launched the application, you can use it to generate AI-generated images based on prompts.
- Enter your idea in the text input field provided.
- Click enter or submit.
- 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.
The code is divided into several parts:
- Importing necessary libraries and setting up environment variables using dotenv.
- Defining a template for generating prompts based on user ideas.
- Creating functions for making prompts and generating images using Stable Diffusion API calls.
- 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.
This project is licensed under the MIT license.
- This application utilizes OpenAI's Stable Diffusion API.
- Streamlit library was used to create the user interface.