NanoBananaLoraDatasetGenerator
š Create LoRA training datasets for Flux 2, Z-Image, Qwen Image Edit & more! Uses FAL.ai + Nano Banana Pro. 100% browser-based, no server needed.
Install / Use
/learn @lovisdotio/NanoBananaLoraDatasetGeneratorREADME
š NanoBanana Pro LoRA Dataset Generator
Create training datasets for image editing models in minutes!
Uses FAL.ai API with Nano Banana Pro to generate high-quality image pairs for training Flux 2, Z-Image, Qwen Image Edit, and other image-to-image models.

š Links
- š Live Demo: lovis.io/NanoBananaLoraDatasetGenerator
- š» Source Code: github.com/lovisdotio/NanoBananaLoraDatasetGenerator
⨠Features
- 4 Generation Modes:
- š Pair Mode - START ā END transformation pairs for image editing LoRAs
- š¼ļø Single Image - Style/aesthetic images for Z-Image and style LoRAs
- š· Reference Image - Upload a character/product and generate variations
- š§© Layered Grid - Generate layered datasets for Qwen Image Layered trainer
- š§ Custom System Prompt - Full control over AI prompt generation
- Zero server setup - Runs entirely in your browser
- Direct FAL API calls - Talks to FAL servers directly
- Parallel generation - Generate multiple images simultaneously
- ZIP download - Download your complete dataset as a ZIP file
- Vision captions - AI-powered image descriptions
- Trigger word support - Add custom prefixes to your training data
šÆ Generation Modes
š Pair Mode (Default)
Generate START ā END image pairs for training image editing models.
- Define a transformation (e.g., "zoom out", "add background", "change lighting")
- AI generates creative base prompts + edit instructions
- Perfect for: Flux 2, Qwen Image Edit, instruction-based models
š¼ļø Single Image Mode
Generate single images with captions for style/aesthetic LoRAs.
- No before/after - just beautiful images with detailed captions
- Perfect for: Z-Image, style transfer, aesthetic LoRAs
š· Reference Image Mode
Upload a reference image and generate variations.
- Upload a character, product, or style reference
- AI creates diverse variations while maintaining consistency
- Perfect for: Character LoRAs, product photography, consistent style training
š§© Layered Grid Mode (NEW!)
Generate datasets for Qwen Image Layered trainer.
- Choose a use case (Character, Architecture, Food, Interior, Fashion, Product, or Custom)
- AI generates element prompts for a grid layout (2x2, 2x3, 2x4, or 4x2)
- Generates grid ā Splits into elements ā Removes backgrounds ā Assembles final image
- Outputs in Qwen Layered format:
_start.png(final) +_end.png,_end2.png... (layers) - Perfect for: Qwen Image Layered trainer, depth-based compositing
Available Presets: | Preset | Elements | Grid | |--------|----------|------| | š® Character | head, torso, legs, shoes | 2Ć2 | | š Architecture | house, garage, people, trees, sky, cars | 2Ć3 | | š Food | ingredients, garnish, sauce | 2Ć2 | | šļø Interior | furniture, decor, plants | 2Ć2 | | š Fashion | top, bottom, shoes, accessory | 2Ć2 | | š¦ Product | product, packaging, accessory, brand | 2Ć2 |
Workflow:
1. Select use case (e.g., Architecture)
2. AI generates element prompts (4 elements)
3. NanoBanana generates 2x2 grid (1:1 aspect ratio)
4. Split grid ā Remove backgrounds (via Bria RMBG 2.0)
5. Assemble elements ā Final composite image
6. Package: final.png + transparent layers + caption
Architecture Example:
Elements generated:
āāā main house or building, modern architecture
āāā secondary structure or garage
āāā people/characters walking or standing
āāā green trees and vegetation
āāā sky and clouds
āāā cars or vehicles parked
Final image: "complete architectural visualization, modern house
exterior with landscaping, people, cars, blue sky"
š Quick Start
Option 1: Local (Double-click)
Simply open index.html in your browser!
ā ļø Some browsers block local file API calls. If it doesn't work, use Option 2.
Option 2: Local Server (Recommended)
python -m http.server 3000
# Open http://localhost:3000
Or with Node.js:
npx serve .
Option 3: Host Online (Free)
Upload these 3 files to any static hosting:
- GitHub Pages - Free, just push to a repo
- Netlify - Drag & drop the folder
- Vercel - Connect your repo
- Cloudflare Pages - Free tier available
š Files
āāā index.html # Main page
āāā app.js # Application logic (calls FAL API directly)
āāā style.css # Styling
āāā README.md # This file
š API Key
- Get your free API key at fal.ai/dashboard/keys
- Click the š button in the app
- Enter your key and save
Security: Your key is stored ONLY in your browser's localStorage. It's never sent anywhere except directly to FAL's servers.
š° Pricing (FAL)
| Resolution | Cost per image | |------------|----------------| | 1K | $0.15 | | 2K | $0.15 | | 4K | $0.30 |
Vision captions: ~$0.002 per image
Examples:
- Pair Mode: 20 pairs Ć 2 images Ć $0.15 = ~$6.00
- Single/Reference Mode: 20 images Ć $0.15 = ~$3.00
šÆ How It Works
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā YOUR BROWSER ā
ā ā
ā 1. Choose mode (Pair / Single / Reference) ā
ā 2. Enter theme + customization ā
ā 3. AI generates creative prompts (via FAL LLM) ā
ā 4. Generate images (via FAL nano-banana-pro) ā
ā 5. Optional: Vision captions (via FAL OpenRouter) ā
ā 6. Download as ZIP ā
ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā
ā ā¼ ā
ā FAL API SERVERS ā
ā (All processing here) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
š¦ Output Format
Pair Mode
nanobanana_dataset_TIMESTAMP.zip
āāā 0001_start.png # Starting image
āāā 0001_end.png # Transformed image
āāā 0001.txt # Action description / caption
āāā 0002_start.png
āāā 0002_end.png
āāā 0002.txt
āāā ...
Single / Reference Mode
nanobanana_dataset_TIMESTAMP.zip
āāā 0001.png # Generated image
āāā 0001.txt # Caption
āāā 0002.png
āāā 0002.txt
āāā ...
Layered Grid Mode (Qwen Format)
qwen_layered_dataset_TIMESTAMP.zip
āāā 0001_start.png # Final assembled image
āāā 0001_end.png # Layer 1 (transparent)
āāā 0001_end2.png # Layer 2 (transparent)
āāā 0001_end3.png # Layer 3 (transparent)
āāā 0001_end4.png # Layer 4 (transparent)
āāā 0001.txt # Caption
āāā 0002_start.png
āāā 0002_end.png
āāā ...
Compatible with:
- Flux 2 - LoRA fine-tuning
- Z-Image - Style/aesthetic training
- Qwen Image Edit - Instruction-based editing
- Qwen Image Layered - Layered/depth-based training (use Layered Grid mode)
- SDXL - Fine-tuning and LoRA
- Any image-to-image model - Universal format
āļø Configuration
| Setting | Description | |---------|-------------| | Mode | Pair, Single Image, Reference Image, or Layered Grid | | Theme | What kind of images to generate (e.g., "portraits of diverse people") | | Transformation | (Pair mode only) What change to learn | | Reference Image | (Reference mode only) Upload character/product/style image | | Use Case | (Layered mode only) Character, Food, Interior, Fashion, Product, or Custom | | Grid Layout | (Layered mode only) 2x2, 2x3, 2x4, or 4x2 (max 8 layers) | | Elements Description | (Layered mode only) Describe each element or let AI generate | | Final Image Description | (Layered mode only) How elements should be assembled | | Custom System Prompt | Customize how AI generates prompts | | Action Name | Optional - AI generates one if empty | | Trigger Word | Optional - Prepended to all .txt files (e.g., "MYZOOM") | | Number of Items | Max 40 per generation (run multiple times for more) | | Parallel | How many to generate simultaneously (1-10) | | Resolution | 1K, 2K, or 4K | | Vision Captions | Use AI to describe generated images |
š§ Customization
Custom System Prompt
The system prompt controls how the AI generates creative prompts. Edit it to:
- Focus on specific styles or aesthetics
- Add constraints or rules
- Target specific use cases
Default prompts are optimized for each mode but can be fully customized.
Change LLM Model
Available in the Settings panel:
google/gemini-2.5-flash(fast, cheap)google/gemini-2.5-pro(better quality)anthropic/claude-3.5-sonnet(excellent quality)openai/gpt-4o(excellent quality)
Parallel Requests
Default is 3. Increase for faster generation (but may hit rate limits).
š Troubleshooting
"Failed to fetch" errors
- Check your API key is valid
- Check you have credits on FAL
- Try reducing parallel requests to 1
CORS errors when opening locally
Use a local server instead of double-clicking:
python -m http.server 3000
Generation is slow
- Increase parallel requests (up to 5-10)
- Use 1K resolution instead of 4K
- Disable vision captions for faster generation
LLM Parser errors
- Keep number of items ⤠40 per generation
- Run multiple generations if you need more
š License
MIT - Use freely for any purpose.
š Credits
- FAL.ai - GPU infrastructure and models
- NanoBanana Pro - Image generation model
- OpenRouter - LLM routing for prompts and captions
Made with š for the AI art community
