MilindChawre's picture
Adding code for stable diffusion using text inversion
45b110b
|
raw
history blame
1.74 kB
metadata
title: Stable Diffusion Using Text Inversion
emoji: πŸŒ–
colorFrom: gray
colorTo: purple
sdk: gradio
sdk_version: 5.22.0
app_file: app.py
pinned: false
short_description: Stable Diffusion using Text Inversion

Stable Diffusion using Text Inversion

A Gradio web application that generates images using Stable Diffusion with various text inversion concepts and loss functions.

Features

  • Generate images using Stable Diffusion v1.4
  • Apply different artistic styles using text inversion concepts:
    • Dreams
    • Midjourney Style
    • Moebius
    • Marc Allante
    • WLOP
  • Automatic application of multiple loss functions:
    • No Loss (Base generation)
    • Blue Channel Loss
    • Elastic Transformation Loss
    • Symmetry Loss
    • Saturation Loss
  • User-friendly interface with preset prompts and custom prompt input
  • Side-by-side comparison of different loss function effects

Usage

  1. Select a preset prompt or enter your own custom prompt
  2. Choose a style concept from the dropdown menu
  3. Click "Submit" to generate images
  4. View the results showing different loss function effects side by side

Installation

  1. Clone this repository
  2. Install the required dependencies:
pip install -r requirements.txt
  1. Run the application:
python app.py

Requirements

  • Python 3.7+
  • PyTorch
  • Diffusers
  • Transformers
  • Gradio
  • Torchvision
  • PIL

Model Details

The application uses the CompVis/stable-diffusion-v1-4 model with text inversion concepts from the Hugging Face SD concepts library. The model runs with float16 precision and supports CUDA, MPS, and CPU devices.

License

This project uses the CompVis/stable-diffusion-v1-4 model which is subject to the CreativeML Open RAIL-M license.