|
--- |
|
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 |
|
|