A newer version of the Gradio SDK is available:
5.38.0
metadata
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:
- Import
spaces
before anytorch
or CUDA-related imports - Select GPU hardware in Space settings
- Add your HF_TOKEN as a Repository Secret (Settings β Repository Secrets)
- 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
- Enter your text prompt
- Optionally provide a negative prompt to exclude unwanted elements
- Choose a model or use the default
- Click "Generate Image"
Image to Image
- Upload an image
- Enter a prompt to guide the transformation
- Choose between HF inference API or ControlNet on-device model
- Click "Transform Image"
tags:
- diffusers
- stable-diffusion
- text-to-image
- image-to-image
- depth-estimation
- controlnet
- spaces
- huggingface-hub