--- title: LegacyScribe emoji: πŸ“– colorFrom: yellow colorTo: red sdk: gradio sdk_version: 6.18.0 app_file: app.py pinned: true license: mit short_description: Turn grandparents' memories into a beautiful memory book tags: - backyard-ai - off-brand - best-agent - best-demo - modal - track:backyard - sponsor:modal - achievement:offgrid - achievement:welltuned - achievement:offbrand - achievement:llama models: - build-small-hackathon/legacystribe-Qwen3.5-9B.Q4_K_M datasets: [] ---
# πŸ“– LegacyScribe ### *Every family has a story worth keeping.* **A family memory agent that turns loose, spoken recollections into a beautiful, printable memory book β€” one gentle question at a time.**
--- ## The Problem Grandparents hold stories, recipes, rituals, and wisdom that no one has written down. Families don't have the time or the skill to extract and preserve them. When those people are gone, so are the stories. LegacyScribe is the assistant that should have existed twenty years ago. --- ## What It Does An elderly person speaks or types loosely β€” *"I remember the soup my mother made during the monsoon…"* β€” and a 5-agent AI pipeline: 1. **Asks one gentle follow-up question** to draw out more detail 2. **Identifies the narrative stage** (setup β†’ tension β†’ turn β†’ meaning) 3. **Extracts structured fragments** β€” who, when, where, what, emotion 4. **Detects contradictions** across sessions and flags them for confirmation 5. **Synthesises everything** into a warm, first-person narrative paragraph The result builds live on screen as a **memory book page** β€” with a leather spine, ruled lines, and a page-flip animation every time a new chapter is written. --- ## The 5-Agent Pipeline --- ## The Model | Property | Detail | |---|---| | Base model | Qwen3.5-9B-Instruct | | Quantization | Q4_K_M GGUF (5.78 GB) | | Fine-tuning method | LoRA rank 16, alpha 32 | | Training examples | 850 culturally-grounded examples | | Training compute | Modal A100-40GB, ~2.5 hours | | Inference | llama.cpp via llama-cpp-python | | Languages | Nepali Β· English Β· mixed | ### Training Dataset β€” 850 Examples Across 5 Agents | Agent | Examples | Categories | |---|---|---| | Questioner | 300 | Festivals & jatras, family, work, food, village | | Arc Detector | 200 | Setup, tension, turn, meaning | | Extractor | 150 | Person & relationship, time & season, place, emotion | | Reconciler | 100 | Date conflict, person identity, factual contradiction, no conflict | | Publisher | 100 | Festival chapter, family story, place & livelihood, mixed memory | All examples are grounded in **Nepali and South Asian cultural context** β€” Dashain, Tihar, Indra Jatra, Guthi, kinship terms (hajuramma, bhauju, sasura), Newar traditions, monsoon seasons, village life. --- ## Modal β€” Training + Inference Modal powers **both** the fine-tuning pipeline and the live inference backend. ### Fine-tuning on Modal ```python @app.function( image=image, gpu="A100-40GB", timeout=60 * 60 * 4, volumes={"/mnt/legacyscribe-data": volume}, ) def train(): from unsloth import FastModel from trl import SFTTrainer, SFTConfig # LoRA rank 16 Β· 3 epochs Β· 850 examples # ~2.5 hours Β· ~$18 from $200 Modal credit ``` ### Inference Backend on Modal The inference backend runs as a dedicated Modal GPU Space, called by the frontend via `gradio_client`: ``` Frontend (HF org Space, CPU) β”‚ gradio_client.predict() β–Ό Backend (Modal, T4 GPU) β”‚ llama.cpp Β· Qwen3.5-9B Q4_K_M β–Ό Response β†’ UI update ``` **Modal was used for:** - βœ… Fine-tuning (A100-40GB, Unsloth + LoRA) - βœ… Dataset volume storage (`legacyscribe-data`) - βœ… Inference backend runtime (T4 GPU) - βœ… GGUF export and model storage --- ## Architecture ``` build-small-hackathon/legacyscribe (org Space β€” UI only, CPU free tier) β”‚ β”‚ gradio_client β–Ό modal/legacyscribe-backend (personal Space β€” T4 GPU, $250 Modal Credits) β”‚ β”‚ llama.cpp β–Ό Qwen3.5-9B Q4_K_M (5.78 GB GGUF) fine-tuned on 850 culturally-grounded examples ``` --- ## Tech Stack | Layer | Technology | |---|---| | Model | Qwen3.5-9B-Instruct β†’ Q4_K_M GGUF | | Fine-tuning | Unsloth + LoRA + TRL SFTTrainer | | Inference | llama.cpp via llama-cpp-python | | Training compute | Modal A100-40GB | | Inference compute | T4 GPU (Modal apps) | | Frontend | Gradio 6 β€” fully custom HTML/CSS/JS | | Backend API | Gradio Interface + gradio_client | | Fonts | Playfair Display Β· Source Serif 4 Β· JetBrains Mono | | Animations | CSS 3D transforms Β· pageFlip keyframes Β· spring easing | --- ## Custom UI LegacyScribe goes well beyond default Gradio components. Every element is custom-built: - **Leather-bound book page** with CSS 3D spine, stitching detail, and page-curl - **Page-flip animation** on every new chapter (`rotateY` + `skewY` keyframes) - **Ruled lines** with text sitting precisely on each line (`line-height: 28px` grid) - **Opening animation** β€” a 3D book cover flips open on load, revealing the app - **Arc pills** β€” colour-coded narrative stage indicators per memory turn - **Memory fragment display** β€” monospace key-value extraction readout - **Walnut + parchment + gold** colour palette throughout No `gr.Chatbot`, no `gr.Markdown`, no stock components in the main UI β€” everything is `gr.HTML` with handwritten CSS. --- ## Demo Video > πŸ“Ή **[Watch the demo](https://youtu.be/fGauUikl-co)** The demo shows: 1. An elderly person sharing a memory of Indra Jatra in Kathmandu 2. The arc detector identifying "setting the scene" 3. The extractor pulling out who, when, where, emotion 4. The questioner asking one warm follow-up 5. The publisher writing the first chapter onto the book page live --- ## Social Post > 🐦 **[View post - Safal Narshing Shrestha](https://x.com/safalnarshing/status/2066610542626910480)** > πŸ“– **[View post - Swoham Kayastha](https://x.com/swohamkayastha/status/2066613735733834133)** --- ## Badges Claimed | Badge | Reason | |---|---| | 🌲 **Backyard AI** | Emotionally resonant, AI-native, whimsical β€” a memory book that writes itself | | 🎨 **Off Brand** | Fully custom UI β€” no default Gradio chrome anywhere in the main interface | | πŸ€– **Best Agent** | 5-agent pipeline with multi-step planning, extraction, reconciliation, and synthesis per turn | | 🎬 **Best Demo** | Demo video + social post + live Space | | ⚑ **Modal** | Fine-tuning + volume storage + inference backend all run on Modal | --- ## Running Locally ```bash git clone https://huggingface.co/spaces/build-small-hackathon/legacyscribe cd legacyscribe pip install gradio gradio_client huggingface_hub # Set your backend URL export BACKEND_URL= "https://swohamkayastha--legacystribe-backend-legacyscribeserver-predict.modal.run/" python app.py # Open http://localhost:7860 ``` To run the full stack locally with the model: ```bash # Download the GGUF huggingface-cli download build-small-hackathon/legacystribe-Qwen3.5-9B.Q4_K_M \ Qwen3.5-9B.Q4_K_M.gguf --local-dir ./model # Run backend pip install llama-cpp-python python backend_app.py ``` --- ## Team Built for the **Build Small Hackathon 2026** by [@safalnarsingh](https://huggingface.co/safalnarsingh) and [@SwohamKayastha](https://huggingface.co/SwohamKayastha). *For every grandmother whose stories deserve to outlast her.* ---
**LegacyScribe Β· Build Small Hackathon 2026 Β· Backyard AI** *Fine-tuned Qwen3.5-9B Β· LoRA Β· llama.cpp Β· Modal Β· Gradio*