Spaces:
Runtime error
title: Lulluna - Bedtime Story Weaver
emoji: π
colorFrom: purple
colorTo: indigo
sdk: docker
app_port: 7860
pinned: true
license: apache-2.0
tags:
- gradio
- llama-cpp
- text-generation
- text-to-speech
- image-generation
- children
- storytelling
- small-models
- build-small-hackathon
- minicpm
- kokoro
- sd-turbo
π Lulluna β Bedtime Story Weaver
HuggingFace Build Small Hackathon 2026 Β· Track: Backyard AI
Lulluna solves a nightly challenge for busy parents: "What story do I read tonight?"
In about 10 seconds it weaves a personalized bedtime story tailored to your child's age, name, and interests β drawing from rich traditions like Aesop, Panchatantra, Norse mythology, and African folktales β with a gentle value quietly threaded in and a soft closing line that helps little ones drift off to sleep.
Every story can be narrated aloud in a warm voice and illustrated with a watercolour storybook image β all on-device, with no API keys and no data leaving the machine.
π€ AI Stack β 100% Local, ~1.96 B Parameters Total
| Component | Model | Params | Runtime |
|---|---|---|---|
| Story generation | MiniCPM5-1B (OpenBMB) | 1.0 B | llama.cpp (GGUF Q4_K_M) |
| Voice narration | Kokoro-82M (hexgrad) | 82 M | PyTorch |
| Illustration | SD Turbo (Stability AI) | ~860 M | Diffusers (4-step) |
| Total | ~1.96 B | All models β€ 32 B β |
π Badge Claims
| Badge | How |
|---|---|
| π¦ Llama Champion | Story engine uses llama.cpp with GGUF Q4_K_M quantization |
| π Off the Grid | Zero cloud API calls β all three models run entirely on-device |
| π Field Notes | Read the build log β |
β¨ How to Use
- Fill in the form on the left: child's name, age, interests, value/theme, cultural tradition, and length.
- Click β¨ Weave tonight's story β the story appears in ~10 s.
- Click ποΈ Narrate to hear it read aloud in a warm voice.
- Click π¨ Illustrate to generate a watercolour storybook cover (takes ~30 s).
Traditions available
Aesop Β· Panchatantra Β· Jataka Β· Japanese Β· African Β· Norse Β· Native American Β· Sufi Β· Celtic Β· Arabian Β· Chinese Β· Grimm
Values available
Kindness Β· Courage Β· Love Β· Honesty Β· Patience Β· Generosity Β· Friendship Β· Perseverance Β· Wisdom Β· Humility
π REST API (companion frontend)
The Space exposes three endpoints for the companion React app:
POST /api/generate
Request: {"data": [age, value, tradition, length, name, interests]}
Response: {"data": [{"title": "...", "emoji": "...", "body": "..."}]}
POST /api/narrate
Request: {"data": ["full story text"]}
Response: {"data": ["{\"audio\": \"<base64 wav>\", \"mime\": \"audio/wav\"}"]}
POST /api/illustrate
Request: {"data": ["title", "body"]}
Response: {"data": ["{\"image\": \"<base64 png>\", \"mime\": \"image/png\"}"]}
π οΈ Local Setup
# 1. Clone and enter the backend directory
git clone https://huggingface.co/spaces/YOUR_USERNAME/lulluna
cd lulluna
# 2. Create a venv (Python 3.10+)
python -m venv .venv && source .venv/bin/activate
# 3. Install deps β Metal on Apple Silicon, CUDA on NVIDIA
CMAKE_ARGS="-DGGML_METAL=on" pip install llama-cpp-python --no-binary llama-cpp-python
pip install -r requirements.txt
# 4. Download the story model (~800 MB, one-time)
python download_model.py
# 5. Launch
python app.py # β http://localhost:7860
HF Spaces GPU note: Set the Space env var
CMAKE_ARGS="-DGGML_CUDA=on"so llama-cpp-python is compiled with CUDA on first boot.
π Repository Structure
app.py β Gradio UI + REST API endpoints
engine.py β StoryEngine: loads MiniCPM5-1B via llama-cpp-python
prompts.py β System-prompt builder (age / value / tradition)
narrate.py β Kokoro-82M TTS (reads stdin β base64 WAV JSON on stdout)
illustrate.py β SD Turbo image gen (reads JSON prompt β base64 PNG JSON)
download_model.py β One-time model downloader from HF Hub
requirements.txt β All Python dependencies (single environment)
packages.txt β System packages for HF Spaces (espeak-ng, ffmpeg)
Built with β€οΈ for the HuggingFace Build Small Hackathon 2026