File size: 1,604 Bytes
caf3333
 
 
 
 
 
 
aae36e9
caf3333
958c213
1ba8d2d
caf3333
 
aae36e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Imagen
emoji: πŸŒ–
colorFrom: pink
colorTo: red
sdk: gradio
sdk_version: 5.22.0
app_file: main.py
pinned: false
license: other
short_description: Generate and edit images
---

# Diffusion Models App

A unified interface for text-to-image and image-to-image generation using Hugging Face models.

## Features

- πŸ–ΌοΈ **Text to Image**: Generate images from text prompts
- πŸ”„ **Image to Image**: Transform images using text prompts
- 🧠 **ControlNet Support**: Built-in ControlNet depth model for enhanced image transformations
- 🌐 **Flexible Models**: Use inference endpoints or on-device models
- πŸš€ **Dual Interface**: Web UI and API endpoints

## Deployment Notes

### IMPORTANT: Using ControlNet on Hugging Face Spaces

For ControlNet to work correctly:

1. Import `spaces` before any `torch` or CUDA-related imports
2. Select GPU hardware in Space settings
3. Add your HF_TOKEN as a Repository Secret (Settings β†’ Repository Secrets)
4. Do NOT commit any sensitive tokens to the repository

If you encounter CUDA initialization errors, ensure spaces package is imported first.

## Usage

### Text to Image
1. Enter your text prompt
2. Optionally provide a negative prompt to exclude unwanted elements
3. Choose a model or use the default
4. Click "Generate Image"

### Image to Image
1. Upload an image
2. Enter a prompt to guide the transformation
3. Choose between HF inference API or ControlNet on-device model
4. Click "Transform Image"

---

tags:
- diffusers
- stable-diffusion
- text-to-image
- image-to-image
- depth-estimation
- controlnet
- spaces
- huggingface-hub