ASTRALK commited on
Commit
289c12c
Β·
verified Β·
1 Parent(s): 00ee856

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +82 -49
README.md CHANGED
@@ -28,82 +28,115 @@ datasets: []
28
 
29
  # AI Comic Studio
30
 
31
- A two-model pipeline that generates a complete **25-page, 50-panel comic book** from a single sentence β€” written by **Gemma 4**, illustrated by **FLUX.2**, served live on **Modal**.
32
 
33
- Type an idea β†’ Gemma writes the story, casts characters with fixed visual descriptions β†’ FLUX renders every panel with consistent art β†’ a Gradio reader presents the finished comic with page navigation.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  ## Pipeline
36
 
37
  ```
38
- Story idea
39
- β”‚
40
- β–Ό
41
- Gemma 4 26B-A4B FLUX.2 Klein 9B
42
- Safety gate Character injection
43
- Story bible Deterministic seeds
44
- 50 panels (5 batches) Batched GPU renders
45
- β”‚ β”‚
46
- β–Ό β–Ό
47
- 25-page comic reader
48
- (live timer Β· page nav)
 
 
 
 
 
49
  ```
50
 
51
- Gemma handles all text. FLUX handles all images. Both models stay under 32B params.
52
-
53
- ## How It Works
54
 
55
- 1. **Safety gate** β€” Gemma approves or refuses the idea
56
- 2. **Story bible** β€” title, logline, fixed cast with verbatim visual descriptions, art style, palette, 25-page synopsis
57
- 3. **Panel script** β€” 5 batches of 5 pages, each fed a recap for continuity
58
- 4. **Image render** β€” FLUX draws each panel using character descriptions injected into every prompt for consistency
59
- 5. **Reader** β€” two panels per page, ← β†’ navigation, live generation timer
 
 
 
 
60
 
61
  ## Models
62
 
63
- | Model | Role | Params | Runtime |
64
- |-------|------|--------|---------|
65
- | `google/gemma-4-26B-A4B-it` | Writer | 26B (4B active MoE) | vLLM on Modal H100 |
66
- | `black-forest-labs/FLUX.2-klein-9B` | Artist | 9B | Diffusers on Modal H100 |
67
 
68
- ## Modal
69
 
70
- Both backends run on Modal with `min_containers=1` β€” no cold boot during demos. Scale-to-zero when idle.
71
 
72
- ```bash
73
- modal app stop comic-gemma && modal app stop comic-flux # cost guard
74
- ```
75
 
76
  ## Custom UI
77
 
78
- No stock Gradio components in the main flow. Everything is `gr.HTML` with handwritten CSS β€” halftone dot background, Anton typography, comic sticker buttons, live ticking stopwatch, panel-by-panel streaming.
79
 
80
  ## Run Locally
81
 
82
  ```bash
83
  pip install -r requirements.txt
84
- COMIC_BACKEND=mock python app.py # offline, no GPU
85
- COMIC_BACKEND=modal python app.py # live (requires Modal deploy)
86
  ```
87
 
88
- ## Badges
89
-
90
- | Badge | Claim |
91
- |-------|-------|
92
- | 🎨 Off Brand | Custom UI β€” no default Gradio chrome |
93
- | πŸ€– Best Agent | Multi-step pipeline with continuity tracking |
94
- | 🎬 Best Demo | Live timer + panel streaming + comic reader |
95
- | ⚑ Modal | vLLM + Diffusers on Modal H100s |
96
- | πŸ“‘ Sharing is Caring | Agent trace published |
97
- | πŸ““ Field Notes | Build write-up |
98
-
99
- ## Demo Video
100
 
101
- > πŸ“Ή [Watch the demo](https://youtu.be/ma_SNY1qats)
 
 
 
 
 
 
 
102
 
103
- ## Social Post
104
 
105
- > 🐦 *[Post link coming soon]*
 
 
 
 
 
 
 
106
 
107
  ---
108
 
109
- **Build Small Hackathon 2026 Β· Thousand Token Wood Β· Modal**
 
28
 
29
  # AI Comic Studio
30
 
31
+ You type one sentence. You get a 25-page, 50-panel comic book. Title, cast, story arc, consistent character art across every panel. Generated live in under 90 seconds.
32
 
33
+ AI Comic Studio chains two small models through a five-stage pipeline. Gemma 4 26B writes the entire comic (safety gate, story bible, 50 panel scripts). FLUX.2 Klein 9B draws every panel. A Gradio reader presents the result with page navigation. No human intervention between idea and finished book.
34
+
35
+ ## Demo
36
+
37
+ [Watch the full demo on YouTube](https://youtu.be/ma_SNY1qats)
38
+
39
+ ## Social Post
40
+
41
+ [View on X](https://x.com/Asura1612913/status/2066635430314095013)
42
+
43
+ ## How It Works
44
+
45
+ **Stage 1: Safety Gate**
46
+ Gemma reviews the idea. Fictional adventure, action, mystery, horror, romance all pass. Only genuinely harmful requests get refused.
47
+
48
+ **Stage 2: Story Bible**
49
+ Gemma produces: title, logline, a fixed cast of 1-4 characters (each with a 30-word visual description reused verbatim in every image prompt), global art style, color palette, and a 25-page synopsis with full narrative arc.
50
+
51
+ **Stage 3: Panel Script**
52
+ Gemma writes 50 panels across 5 batches of 5 pages. Each batch receives a recap of all prior panels for story continuity.
53
+
54
+ **Stage 4: Image Render**
55
+ FLUX.2 renders every panel at 832x576. Character appearance text from the bible is injected into each prompt. Deterministic seeds per panel keep the art consistent from page 1 to page 25.
56
+
57
+ **Stage 5: Reader**
58
+ The Gradio UI streams panels live as they render, then presents the finished comic: two image+caption panels per page, left/right navigation, and a frozen generation timer.
59
 
60
  ## Pipeline
61
 
62
  ```
63
+ "Idea"
64
+ β”‚
65
+ β”œβ”€ Gemma 4 26B-A4B (Writer)
66
+ β”‚ β”œβ”€ Safety gate
67
+ β”‚ β”œβ”€ Story bible (title, cast, style, 25-page synopsis)
68
+ β”‚ └─ 50 panels in 5 batches (continuity recap per batch)
69
+ β”‚
70
+ β”œβ”€ FLUX.2 Klein 9B (Artist)
71
+ β”‚ β”œβ”€ Character injection per prompt
72
+ β”‚ β”œβ”€ Deterministic seeds
73
+ β”‚ └─ Batched renders (4 panels per GPU pass)
74
+ β”‚
75
+ └─ Gradio Reader
76
+ β”œβ”€ Live panel streaming
77
+ β”œβ”€ Page navigation
78
+ └─ Generation timer
79
  ```
80
 
81
+ ## Performance
 
 
82
 
83
+ | Metric | Value |
84
+ |--------|-------|
85
+ | Warm generation (both GPUs hot) | ~60-90s |
86
+ | Cold start (first call) | +1-3 min |
87
+ | Panels per batch | 4 |
88
+ | Total panels | 50 |
89
+ | Total pages | 25 |
90
+ | Image resolution | 832x576 |
91
+ | FLUX inference steps | 4 |
92
 
93
  ## Models
94
 
95
+ | Model | Parameters | Role | Runtime |
96
+ |-------|-----------|------|---------|
97
+ | `google/gemma-4-26B-A4B-it` | 26B (4B active MoE) | All text: safety, bible, panels | vLLM, Modal H100 |
98
+ | `black-forest-labs/FLUX.2-klein-9B` | 9B | All images: panel renders | Diffusers, Modal H100 |
99
 
100
+ Both models stay under the 32B cap. Gemma never draws. FLUX never writes.
101
 
102
+ ## Character Consistency
103
 
104
+ The core problem in multi-panel comics: FLUX renders each panel independently. AI Comic Studio solves this with verbatim appearance injection. Every character gets a detailed visual description in the story bible (species, build, age, hair, face, clothing, colors, props). That exact text is injected into every FLUX prompt where the character appears. Combined with deterministic seeds, this keeps characters recognizable across 50 panels.
 
 
105
 
106
  ## Custom UI
107
 
108
+ No stock Gradio components in the main flow. Everything is `gr.HTML` with handwritten CSS: halftone dot background, Anton typography, comic sticker buttons with 3D press effects, live ticking stopwatch at 100ms intervals, panel-by-panel streaming during generation.
109
 
110
  ## Run Locally
111
 
112
  ```bash
113
  pip install -r requirements.txt
114
+ COMIC_BACKEND=mock python app.py # offline, full UI, no GPU
115
+ COMIC_BACKEND=modal python app.py # live models on Modal
116
  ```
117
 
118
+ ## Qualification
 
 
 
 
 
 
 
 
 
 
 
119
 
120
+ | Criteria | Status |
121
+ |----------|--------|
122
+ | Under 32B params | 26B + 9B, both under cap |
123
+ | Gradio Space | Deployed on HF Spaces |
124
+ | Demo video | [YouTube](https://youtu.be/ma_SNY1qats) |
125
+ | Social post | [X/Twitter](https://x.com/Asura1612913/status/2066635430314095013) |
126
+ | README tagged | Done |
127
+ | Modal used | vLLM + Diffusers on Modal H100s |
128
 
129
+ ## Badges
130
 
131
+ | Badge | Qualifies |
132
+ |-------|-----------|
133
+ | Off Brand | Yes. Custom UI, no default Gradio chrome. |
134
+ | Best Agent | Yes. 5-stage pipeline with continuity tracking across 50 panels. |
135
+ | Best Demo | Yes. Live timer, panel streaming, full comic reader. |
136
+ | Modal | Yes. Both backends on Modal H100s with scale-to-zero. |
137
+ | Sharing is Caring | Yes. [Social post](https://x.com/Asura1612913/status/2066635430314095013) published. |
138
+ | Field Notes | Pending. Build write-up to be published. |
139
 
140
  ---
141
 
142
+ **Build Small Hackathon 2026 Β· Thousand Token Wood**