DEV Community

Nehir Akbaş
Nehir Akbaş

Posted on

How I Built a Prompt Generator to Create 10K+ AI Image Prompts for My ML Dataset

How I Built a Prompt Generator to Create 10K+ AI Image Prompts for My ML Dataset

The Problem

I was training a custom ML model and needed a large, diverse image dataset. My options:

  1. Scrape the internet - Copyright issues, inconsistent quality, messy metadata
  2. Use GPT - Repetitive outputs, no structure, expensive at scale
  3. Generate my own images - But I needed thousands of unique, categorized prompts

Manually writing prompts? Not an option.

The Solution: PromptAnvil

I built PromptAnvil - a prompt configuration tool that generates hundreds of unique, structured prompts in seconds.

Core Concept

Instead of writing prompts one by one, you define:

  • Categories (subject, style, lighting, mood, etc.)
  • Entries with optional weights
  • Templates using {tokens}
  • Logic rules for context control

Then hit generate → get unique combinations.

Quick Example

Categories:
- subject: cat, dog, owl
- style: watercolor, oil painting, pixel art
- mood: peaceful, dramatic

Template: "{subject} in {style} style, {mood} atmosphere"

Output:
→ "cat in watercolor style, peaceful atmosphere"
→ "owl in pixel art style, dramatic atmosphere"
→ ... 18 unique combinations
Enter fullscreen mode Exit fullscreen mode

Scale up to thousands by adding more entries.

Key Features

1. Weighted Randomization

subject:
  - warrior (weight: 3)
  - mage (weight: 1)
  - archer (weight: 1)
Enter fullscreen mode Exit fullscreen mode

Warrior appears 60% of the time.

2. Conditional Logic

IF subject = "archer" THEN setting = "forest"
IF setting = "ruins" THEN EXCLUDE mood = "peaceful"
Enter fullscreen mode Exit fullscreen mode

No more archers in castles or peaceful ruins.

3. Tag Linking

Group related entries across categories:

Tag "cyber":
- setting: neon-lit megacity
- clothing: tech jacket
- lighting: pink neon glow
Enter fullscreen mode Exit fullscreen mode

When one is selected, others follow. Context stays coherent.

4. Export Options

  • JSON - For programmatic pipelines
  • TXT - One prompt per line
  • CSV - With category metadata

Perfect for batch processing with ComfyUI, Automatic1111, or custom scripts.

5. AI-Powered Helpers

  • Config Generator - Describe what you want, AI builds the entire configuration
  • Entry Generator - AI suggests entries for your categories
  • Logic Rule Generator - AI creates smart conditional rules
  • Prompt Refiner - 3-agent pipeline (Critic → Refiner → Evaluator) improves your prompts

Still in active development, but already saves time of manual setup.

Tech Stack

  • Next.js 15 (React 19)
  • TypeScript
  • Zustand for state management
  • Supabase for auth & cloud sync
  • Java + Spring Boot backend
  • Redis for rate limiting & caching

Try It

🔗 promptanvil.com

Free to use. No signup required for basic features.

Built this to solve my own problem - now sharing with the community. Feedback welcome!


Top comments (0)