vaibhavpandeyvpz's picture
Setup Flux.2 image generation
b4e0f77

A newer version of the Gradio SDK is available: 6.2.0

Upgrade
metadata
title: FLUX.2 Text to Image
emoji: 🖼
colorFrom: purple
colorTo: red
sdk: gradio
sdk_version: 6.0.2
app_file: app.py
pinned: true
license: apache-2.0
short_description: Generate production-grade AI images using FLUX.2 [dev]

FLUX.2 [dev] Text-to-Image

Generate high-quality images using FLUX.2 [dev], a 32B parameter rectified flow model by Black Forest Labs.

Features

  • Text-to-Image Generation: Create images from text prompts
  • Image Editing: Upload images for editing and manipulation
  • Image Combining: Combine multiple images based on text instructions
  • Prompt Upsampling: Automatically enhance prompts using a VLM (optional)
  • ZeroGPU Support: Optimized for ZeroGPU inference
  • Advanced Controls: Fine-tune generation with seed, guidance scale, inference steps, and dimensions

Setup

This Space requires:

  • ZeroGPU: Enable ZeroGPU in your Space settings
  • HF_TOKEN: Set your Hugging Face token as a Space secret for gated model access
    • Go to Settings → Secrets → Add HF_TOKEN with your Hugging Face token

Model

Usage

  1. Enter a text prompt describing the image you want to generate
  2. (Optional) Upload one or more images for editing/combining
  3. Adjust advanced settings as needed:
    • Prompt Upsampling: Enable to automatically enhance your prompt
    • Seed: Control randomness (use randomize for variety)
    • Dimensions: Width and height (must be multiples of 8)
    • Inference Steps: More steps = higher quality but slower (default: 30)
    • Guidance Scale: How closely to follow the prompt (default: 4.0)
  4. Click "Run" to generate your image

Notes

  • The model uses pre-compiled blocks for ZeroGPU optimization
  • Prompt upsampling requires a valid HF_TOKEN secret
  • Image dimensions are automatically adjusted when uploading images
  • Supports image editing and combining multiple images

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference