跳到正文
DEV Community· Sanjana Devi·· 3 小時前AI 評分37

Ofrenda Viva:以 Gemma 2 與 ElevenLabs 打造數碼紀念祭壇

Ofrenda Viva (Living Altar)

AI 導讀

Ofrenda Viva 是一款單頁數碼紀念應用程式,運用 Google 的開放權重模型 gemma-2-2b-it,從用戶講述或輸入的故事中提取逝者姓名、供品等資料,並撰寫雙語紀念詩。應用程式透過 ElevenLabs Multilingual V2 將詩句轉為語音;未提供 API key 時,會改用瀏覽器內置語音合成。它採用本地優先設計,將用戶憑證儲存在 localStorage。

正文

*This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine*

What I Built

Ofrenda Viva (Living Altar) is an intimate, single-page digital remembrance sanctuary inspired by the Mexican tradition of Día de los Muertos (Day of the Dead).

When we lose someone, what we miss most are the sensory, everyday details: the scent of cinnamon in morning coffee, the sound of acoustic chords strummed on a porch, or the secret treats slipped across a kitchen table. Ofrenda Viva allows families and storytellers to preserve these oral memories before they fade.

A user speaks or types an unstructured, freeform story about an ancestor. The application leverages Google's open-weight Gemma 2 model to gently channel the memory—extracting the ancestor's name, curating their favorite foods and symbolic altar offerings, counting sacred cempasúchil (marigold) petals, and composing a poetic bilingual remembrance verse. The tribute is then spoken aloud using ElevenLabs expressive voice synthesis, transforming raw text into an oral vigil accompanied by glowing candlelight and drifting marigold petals.


Demo


Code

https://github.com/sanjana806/Ofrenda-Viva

The application is built with a zero-dependency, local-first philosophy: a responsive, single-file client interface backed by lightweight API calls directly from the browser, saving user credentials entirely in local storage.


How I Built It

The architecture is designed to make cultural heritage preservation completely client-sovereign and lightweight:

  1. The Open-Weight Brain (Google Gemma 2): We run google/gemma-2-2b-it via Hugging Face Serverless Inference. Using structured few-shot prompting, Gemma acts as the "altar keeper," analyzing colloquial storytelling and extracting clean, valid JSON with strictly enforced keys:
  2. honored_name: The individual honored.
  3. epitaph: A 2-sentence poetic tribute.
  4. offerings: An array of specific dishes, items, or habits mentioned (e.g., pan dulce, espresso, vintage camera).
  5. marigold_count: Visual petal weight between 3 and 12.

  6. The Oral Voice (ElevenLabs Multilingual V2):
    Día de los Muertos is historically an oral tradition passed down through voices, chants, and songs. The poetic epitaph synthesized by Gemma is piped into ElevenLabs' Text-to-Speech API (eleven_multilingual_v2, using the warm "George" voice) to generate an immediate audio vigil. If an ElevenLabs API key is not supplied, the interface automatically falls back to native browser speech synthesis (window.speechSynthesis).

  7. Atmospheric Altar UI:
    Crafted in vanilla HTML5, CSS3, and JavaScript, the interface features:

  8. An HTML5 <canvas> simulation of golden marigold petals floating continuously across the viewport.

  9. Subtle CSS keyframe animations emulating real candlelight glow and shadows.

  10. A client-side key vault keeping Hugging Face access tokens and ElevenLabs keys strictly inside localStorage.


Why Does Open Innovation Matter?

Open innovation is not just a software paradigm; in this project, it is an ethical requirement.

  1. Sacred Grief and Absolute Data Sovereignty: Grief, eulogies, and family memories are deeply personal. When you upload oral histories and recordings of deceased grandparents to closed, proprietary enterprise platforms, your family's heritage risks becoming unconsented training data for commercial models. With open-weight models like Gemma 2, the code and weights can be run offline on a local laptop using Ollama or vLLM—ensuring that memories never leave the family circle.
  2. Digital Permanence Over Proprietary Lifecycles: Closed APIs get acquired, change pricing tiers, alter content moderation guidelines, or sunset entirely without warning. A memorial service built on top of a closed cloud ecosystem could vanish in five years. Open-weight models can be downloaded, mirrored, and archived on cold storage, ensuring that the technology honoring our ancestors can still run decades from now without requiring an active credit card or network connection.
  3. Democratizing Community Archives: Grassroots archivists, oral historians, and indigenous story preservationists operate with zero budget. Lightweight open models make sophisticated language processing accessible on modest hardware without per-token recurring bills.

My Agent Session

Session traces documenting the prompt iteration, JSON schema validation, and ElevenLabs audio stream decoding were recorded with DevRelay. You can inspect the prompt testing workflow here.


The Spirit of It

During initial testing, I entered a brief memory about my grandfather: how he always had tobacco leaves drying in his shed, drank scalding black coffee at sunrise, and wore a worn leather watch that ticked louder than anything in the room.

Seeing the altar flicker to life, display his name surrounded by sugar-skull tags, and hear a resonant voice read back:

"The earth remembers the quiet tick of his watch and the dawn coffee shared in silence; through every harvest and golden blossom, his gentle fire warms the home still."

It gave me literal goosebumps. For a few seconds, the line between technology and remembrance vanished. That is what open-source AI makes possible: tools built with intention, soul, and dignity.


Prize Categories

  • Best Use of Gemma: Utilizes Google's open-weight gemma-2-2b-it model as the primary semantic reasoning engine to parse unstructured human memories, extract cultural artifacts, and compose memorial verses.
  • Best Use of ElevenLabs: Bridges the written word back to oral tradition by synthesizing the generated memorial epitaph into a warm, lifelike spoken vigil.

來源:DEV Community · dev.to