A rebuild of the Hugging Face AI Comic Factory pipeline, using one HF token for everything via HF Inference Providers — an aggregator that routes requests to fal.ai, Replicate, Nebius, Together, Groq, etc. and bills against your HF account (small free monthly credit included, no GPU to manage).
🌟 Main artifact: comic-teen-ai.html
▶ Read it online: https://boweiliu.github.io/comic-hack/comic-teen-ai.html
It's a single flat HTML file — no build, no dependencies. To view it locally,
just open comic-teen-ai.html in a browser (double-click works).
A hand-built, fully self-contained HTML comic — "Teen AI Chat Assistant" — with CSS grid panels, crisp caption/speech-bubble overlays, scroll fade-in, and click-to-zoom. No build step, no dependencies.
Sample panel art from the project (iteration history):
| v1 | v2 | v3 | final |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
A generated 6-panel example comic lives in out/comic.html
(panels in out/panel_*.png).
story prompt
├─► LLM (chat completion) ──► per-panel JSON script (caption / dialogue / scene)
├─► text-to-image model ────► one PNG per panel
└─► HTML generator ─────────► comic.html (CSS grid + captions + speech bubbles,
scroll fade-in, click-to-zoom)
Text is not rendered inside images (diffusion models garble lettering) — captions and dialogue are HTML/CSS overlays, so they're always crisp and editable.
pip install -r requirements.txt
cp .env.example .env # paste your HF token (https://huggingface.co/settings/tokens)python3 comic.py "a lonely robot learns to bake bread on a space station" \
-n 6 -t "Crust in Space" -s franco -o out
open out/comic.htmlfranco (bande dessinée), manga, super (superhero), noir, pixel, water
— or -s custom --style-text "your own style description".
| flag | default | notes |
|---|---|---|
--llm-model |
Qwen/Qwen2.5-72B-Instruct |
any chat model available on Inference Providers |
--image-model |
black-forest-labs/FLUX.1-schnell |
fast/cheap; try stabilityai/stable-diffusion-xl-base-1.0 or HiDream-ai/HiDream-I1-Fast |
--llm-provider / --image-provider |
auto |
pin to fal-ai, replicate, nebius, groq... if auto picks a flaky one |
--seed |
42 | same seed + same story = reproducible panels; delete a PNG and re-run to re-roll just that panel |
Model availability per provider: check the "Inference Providers" widget on any
model page at huggingface.co/models (filter: inference=warm).
| path | what |
|---|---|
comic-teen-ai.html |
Main artifact — the Teen AI Chat Assistant comic |
comic.py |
CLI pipeline: story → LLM panel script → images → HTML comic |
out/ |
Example generated comic (6 panels + comic.html + script.json) |
web-app/ |
Interactive web version: small Python server + browser UI for editing/regenerating panels |
.pi/skills/ian-xiaohei-illustrations/ |
The pi skill used to generate the illustration style (SKILL.md + references + examples) |
BUILD-NOTES.md |
Detailed build notes from the session |
notes/ |
Research notes on related illustration skills |
01-teen-ai-chat-assistant*.png |
Panel-art iteration history (v1 → final) |
cd web-app
cp ../.env.example .env # add HF token
python3 server.py # serves the UI + generation endpointsDiffusion text-to-image won't keep characters identical across panels. Tricks, in order of effort:
- Prompt discipline (already built in): the LLM is instructed to repeat the
exact same character description in every scene. Fixed
--seedhelps too. - Editing models: swap the renderer for an image-editing model
(e.g.
black-forest-labs/FLUX.1-Kontext-devor Gemini 2.5 Flash Image via API) and pass panel 1 as reference for panels 2..N — big consistency win. - Character LoRA: train one per character (~15 min on fal.ai / a rented A10) and trigger it in every scene prompt. Best results, most work.
comic-teen-ai.html is a plain static page — easy to extend:
- Scroll effects / parallax: drop in GSAP ScrollTrigger
- Branching story: generate one comic per branch, link panels with Twine
- Hosting: push the
out/folder to GitHub Pages or Netlify
With free monthly HF credits you can generate a few comics for free. Beyond that: FLUX.1-schnell ≈ $0.003/image on fal → a 6-panel comic costs < $0.05 all-in.



