Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
5.46.1
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a Hugging Face Spaces application that generates images in Pablo Picasso's cubist style using the FLUX.1-dev model from Black Forest Labs. The app uses Gradio to create a web interface with ZeroGPU acceleration for high-quality text-to-image generation.
Architecture
- app.py: Gradio application using FLUX.1-dev for Picasso-style image generation
- README.md: Hugging Face Spaces configuration file with metadata (title, emoji, SDK version, etc.)
- requirements.txt: Python dependencies including PyTorch, Diffusers, and Gradio
- .gitattributes: Git LFS configuration for handling large model files and binary assets
Key Commands
Running the Application
python app.py
This launches the Gradio interface locally for testing (requires GPU).
Hugging Face Spaces Deployment
The app is automatically deployed to Hugging Face Spaces with ZeroGPU. Changes to app.py
will trigger redeployment.
Development Notes
- Uses FLUX.1-dev model from Black Forest Labs for high-quality text-to-image generation
- @spaces.GPU decorators are required for ZeroGPU compatibility
- Model runs in bfloat16 precision for optimal performance on H200 GPUs
- Output resolution is 1024x1024 pixels
- Optimal parameters: 28 inference steps, guidance scale 3.5
- Prompt enhancement automatically adds Picasso-style descriptors
Code Architecture
Core Components
- Model Loading:
load_model()
function initializes FLUX.1-dev pipeline with bfloat16 precision - Image Generation:
generate_image()
function handles prompt enhancement and image generation with configurable parameters - UI Interface: Gradio Blocks layout with prompt input, parameter sliders, and example buttons
- Example System: Pre-defined example prompts accessible through vertical button layout
Key Functions
load_model()
(app.py:9): Loads and configures the FLUX.1-dev pipelinegenerate_image()
(app.py:27): Main generation function with Picasso-style prompt enhancement- Example setter functions (app.py:88-97): Populate prompt input with predefined examples