Skip to content

nileshsarkar-ai/Image-Generation-with-Stable-Diffusion-v1.5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Image Generation Using Stable Diffusion v1.5 (RunwayML)

This project demonstrates how to generate high-quality images from text prompts using the Stable Diffusion v1.5 model from RunwayML. Built with Python and the diffusers library, this pipeline makes it easy to create visually stunning images for creative exploration, concept art, and more.

Table of Contents

Overview

Stable Diffusion is a state-of-the-art text-to-image model that transforms descriptive prompts into detailed images with artful precision. This project provides an accessible, GPU-accelerated pipeline to turn your ideas into visual content using the Stable Diffusion v1.5 model hosted on RunwayML.

Features

  • Text-to-Image Generation: Create images from detailed text prompts.
  • Negative Prompts: Improve quality by excluding unwanted elements.
  • Customizable Outputs: Save your creations locally in .jpg format.
  • GPU Acceleration: Enjoy faster generation times with CUDA-enabled GPUs.
  • Intuitive Pipeline: Easy-to-use framework built with the diffusers library.

Requirements

  • Python: Version 3.7 or higher.
  • Hardware: CUDA-enabled GPU with appropriate drivers.
  • Dependencies:
    • diffusers
    • transformers
    • torch

Installation

1. Clone the Repository:

git clone 
cd Image_Generation_Using_Stable_Diffusion

2. Install Required Dependencies:

Ensure your system has a CUDA-enabled GPU and the necessary drivers, then install the Python packages using pip:

pip install diffusers transformers torch

Usage

1. Open the Notebook:

Launch the Image_Generation_Stable_Diffusion_1_5_RunwayML.ipynb file in your preferred environment (Jupyter Notebook, VS Code, etc.).

2. Customize Your Prompt:

Modify the prompt variable to describe the image you want to generate:

prompt = "A bustling futuristic city with flying cars and neon lights at night."

3. Run the Cells:

Execute the notebook cells to generate your image. The resulting image will be saved as stable_diffusion_image_generation.jpg in the project directory. (You can change the filename in the notebook as needed.)

Prompt Examples

Experiment with different prompts to explore creative possibilities:

  • "A serene landscape with a crystal-clear lake surrounded by snow-capped mountains under a starry sky."
  • "A bustling futuristic city with flying cars and neon lights at night."
  • "A magical forest with glowing mushrooms and a fairy fluttering among the trees."
  • "A cyberpunk-themed cityscape with neon lights and towering skyscrapers."
  • "A steampunk airship soaring through the clouds during sunset."

Output

The generated images will be saved in the project directory as stable_diffusion_image_generation.jpg. Modify the output filename in the notebook if you’d like to customize it.

Model Information

This project uses the Stable Diffusion v1.5 model provided by RunwayML. For further details, check out the model’s Hugging Face page.

How It Works

1. Model Loading

The model is loaded using the diffusers library and optimized for GPU acceleration with torch.float16 precision.

2. Prompt Processing

The user inputs a descriptive prompt (and an optional negative prompt) that guides the image generation process.

3. Image Generation

The model interprets the prompt and generates a corresponding image.

4. Image Saving

The final image is saved locally in the .jpg format for easy access and further use.

Negative Prompts

To refine image quality, you can use negative prompts to instruct the model to avoid specific elements. For example:

negative_prompt = """
simple background, duplicate, low quality, lowest quality,
bad anatomy, bad proportions, extra digits, lowres, username,
artist name, error, duplicate, watermark, signature, text,
extra digit, fewer digits, worst quality, jpeg artifacts, blurry
"""

Contributing

Contributions are welcome! If you have ideas or improvements, feel free to submit a pull request or open an issue. Your contributions help make this project even better.

License

This project is licensed under the MIT License.


Enjoy exploring the capabilities of Stable Diffusion v1.5! For further development, you might consider adding interactive web interfaces, real-time previews, or integrating more advanced prompt-engineering techniques to take your image generation to the next level.


This version ensures that everything is properly formatted for Markdown while improving readability and organization. Let me know if you need any adjustments!

About

This project uses the Stable Diffusion v1.5 model from RunwayML to generate high-quality images from descriptive text prompts. Built with the diffusers library, it supports GPU acceleration, negative prompting for refined outputs, and customizable image saving, ideal for creative exploration and concept art.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors