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