Back to .md Directory

Prompt Generator

Generates Stable Diffusion and Flux prompts via Qwen3-8B on Ollama, with a Gradio UI and CLI.

May 2, 2026
0 downloads
3 views
ai prompt safety
View source

What this file does

Generates Stable Diffusion and Flux prompts via Qwen3-8B on Ollama, with a Gradio UI and CLI.

When to use it

  • You want a ready-made prompt generator for AI art
  • You need a Gradio web UI for prompt crafting
  • You want to experiment with style presets and Jinja2 templates
  • You need a stateless Python API for prompt generation

Assumes this stack

PythonOllamaQwen3-8BGradioJinja2

Prompt Generator

A Python tool that uses Qwen3-8B via Ollama to generate high-quality prompts for Stable Diffusion and Flux.

Project Overview

  • Core Technology: Qwen3-8B via Ollama
  • Purpose: Generate detailed, style-specific prompts for generative AI art
  • Key Features:
    • Gradio Web UI with style selector and parameter controls
    • Fast generation (~7s per prompt)
    • 7 style presets (cinematic, anime, fantasy, cyberpunk, etc.)
    • Jinja2 templating for customizable prompts
    • Temperature/Top-P controls via Ollama API
    • Automatic reasoning extraction (strips "Thinking..." blocks)

Key Files

  • app.py: Gradio web UI
  • qwen_generator.py: Core generator - CLI and Python API
  • config/templates.yaml: Jinja2 style templates

Usage

# Web UI (recommended)
python app.py

# CLI
python qwen_generator.py "a mystical forest" --style fantasy

# CLI with advanced options
python qwen_generator.py "cyberpunk city" --style cyberpunk --temperature 0.8 --emphasis "neon lighting"

# List styles
python qwen_generator.py --list-styles

Requirements

  • Python 3.8+
  • Ollama with qwen3:8b model
pip install -r requirements.txt
ollama pull qwen3:8b

Development Notes

  • Style System: Jinja2 templates in config/templates.yaml
  • Thread Safety: generate_prompt() accepts params directly (stateless)
  • Output Cleaning: extract_final_prompt() removes reasoning blocks
  • Timeout: Default 120s, configurable via --timeout

What's inside

1 project overview, 1 key files list, 1 usage section, 1 requirements list, 1 development notes section

Change this for your project

  • Replace qwen3:8b with your Ollama model name
  • Replace config/templates.yaml path if you move templates
  • Replace Limbicnation/prompt-gen with your own repository URL

Where it goes

Keep it in your repository where the agent or team that needs it will read it.

Related Documents