| --- |
| title: Tonight's Tale |
| emoji: π |
| colorFrom: indigo |
| colorTo: pink |
| sdk: gradio |
| sdk_version: "5.49.1" |
| app_file: app.py |
| pinned: false |
| license: apache-2.0 |
| models: |
| - Qwen/Qwen3.5-4B |
| - Tongyi-MAI/Z-Image-Turbo |
| - hexgrad/Kokoro-82M |
| tags: |
| - build-small-hackathon |
| short_description: Turn your child's day into an illustrated bedtime story |
| --- |
| |
| # π Tonight's Tale β Build Small Hackathon (Backyard AI track) |
|
|
| **The real problem (mine, every single night):** my kid had a rough moment today β wouldn't share |
| toys, quarreled with a friend. Lecturing a 4-year-old at bedtime doesn't work. But a story about a |
| little rabbit facing *the same* dilemma? That works. |
|
|
| **What it does:** describe what happened in your child's day. The app weaves it into an illustrated, |
| narrated fairy tale starring your child's favorite recurring characters β with **choice points the |
| child decides**. A "wrong" turn leads to a *gentle, recoverable* setback ending; then you rewind |
| together: *"what if we'd chosen differently?"* β and replay the other branch to a warm ending. |
| The moral is shown **only to the parent**; the story itself never preaches. |
|
|
| ## Small models, big adventure (β10B total, β€ 32B β) |
|
|
| | Job | Model | Size | |
| |---|---|---| |
| | Story writing (zh/en/de/fr, branching, JSON) | [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) | 4B | |
| | Watercolor illustrations | [Tongyi-MAI/Z-Image-Turbo](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo) | 6B | |
| | Bedtime narration | [hexgrad/Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) | 0.08B | |
|
|
| Living with small-model limitations is the engineering core here, hardened on a 4GB-VRAM laptop |
| before this Space existed: schema-in-prompt JSON generation with balanced-brace extraction, |
| tolerant output normalization, business-invariant validation with corrective retries, and |
| "soft issues" that retry once then accept. Character visual consistency uses fixed English |
| appearance descriptions + one seed per story β no adapters needed. |
|
|
| ## Try it (10 seconds) |
|
|
| The cast is pre-filled. Just type what happened today β e.g. |
| *"Didn't want to share toys at kindergarten and quarreled with a best friend"* β and press |
| **Weave tonight's story**. Make a choice when the story pauses. If you land on the rainy ending, |
| go back and try the other path. π§οΈβπ |
|
|
| Run locally without any GPU: `STORY_MOCK=1 python app.py` (mock story/images/audio, full UI flow). |
|
|