File size: 2,103 Bytes
a240ddb
 
 
 
 
 
 
 
 
 
 
 
048d5e5
45b110b
048d5e5
45b110b
 
 
048d5e5
 
45b110b
 
 
 
 
048d5e5
 
 
 
 
 
45b110b
048d5e5
45b110b
048d5e5
 
 
 
 
 
45b110b
 
 
048d5e5
 
 
 
 
45b110b
 
 
 
048d5e5
 
 
45b110b
 
 
048d5e5
45b110b
048d5e5
 
 
 
 
 
 
45b110b
048d5e5
 
 
 
 
 
 
 
 
 
 
45b110b
 
048d5e5
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
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 with Text Inversion and Style Transfer

A Gradio-based web application that generates images using Stable Diffusion with various style concepts and loss functions.

## Features

- Text-to-image generation using Stable Diffusion v1.4
- Multiple pre-trained style concepts:
  - Dreams
  - Midjourney Style
  - Moebius
  - Marc Allante
  - WLOP
- Five different image variations using loss functions:
  1. Original (No Loss)
  2. Blue Channel Loss
  3. Elastic Loss
  4. Symmetry Loss
  5. Saturation Loss

## Requirements

- Python 3.8+
- PyTorch
- Diffusers
- Gradio
- PIL
- Torchvision

## Installation

1. Clone the repository:
```bash
git clone <repository-url>
cd stable-diffusion-using-text-inversion
```
2. Install the required dependencies:
```bash
pip install -r requirements.txt
```

## Usage
1. Run the application:
```bash
python app.py
```
2. Open your web browser and navigate to:

- Local URL: http://127.0.0.1:7860
- Or use the public URL provided in the terminal
3. Select or enter a prompt and choose a style concept
4. Click submit and wait for the images to generate.py

## Image Generation Process
The application generates five variations of each image:

1. Original Image : Base generation without modifications
2. Blue Channel Loss : Enhanced blue tones for atmospheric effects
3. Elastic Loss : Added elastic deformation for artistic distortion
4. Symmetry Loss : Enforced symmetrical features
5. Saturation Loss : Modified color saturation for vibrant effects

## Performance Notes
- Image generation takes several minutes per set
- Uses 384x384 resolution for optimal speed/quality balance
- CUDA-enabled GPU recommended for faster generation
- Supports CPU, CUDA, and MPS (Apple Silicon) backends

## License
MIT License

## Acknowledgments
- Stable Diffusion by CompVis
- Textual Inversion concepts from Hugging Face's SD Concepts Library