跳到正文
DEV Community· Hardik Kumar·· 3 小時前AI 評分38

Memoria Local:為亡靈節打造的離線 AI 數碼祭壇

👻 Memoria Local: An Offline AI Digital Ofrenda for Día de los Muertos

AI 導讀

Memoria Local 是一款完全離線運行的 Python CLI 工具,利用本地開放權重語音模型轉錄家人的回憶錄音,再以本地 LLM 摘取人生教誨和珍貴回憶,整理成可列印的紀念文。工具透過 Whisper 和 Ollama 運行 Llama 3.2,整個流程毋須連接網絡,讓錄音及家庭回憶留在用戶自己的裝置上。

正文

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

What I Built

I built Memoria Local, a completely offline Python CLI tool that helps families build a "Digital Ofrenda" for Día de los Muertos. You feed it an audio recording of a family member sharing a memory about a passed loved one. It uses a local open-weight speech model to transcribe the story, and a local open-weight LLM to extract life lessons, favorite memories, and format it into a beautiful, printable tribute.

The inspiration came from the fleeting nature of oral history. When elders pass, their stories often go with them. I wanted a way to capture and honor those voices without sending deeply intimate family grief and memories to corporate cloud servers.

Demo

Here is the terminal output when processing a recording of my grandfather talking about my late grandmother:

$ python memoria.py grandma_story.wav
🕯️  Loading Whisper locally... transcribing the spirits...
🦙 Waking up the local archivist (Llama 3.2)...

--- 🌼 Ofrenda Tribute: The Keeper of the Garden ---

Life Lessons She Taught Us:
1. Patience is the water that makes the seeds grow.
2. A shared meal is the strongest bridge between strangers.
3. Never let the sun set on an unspoken "I love you."

Closing Blessing:
May her memory be a light on the path of the ancestors, and may the scent of cempasúchil always guide her home to us.
------------------------------------

Code

Since I'm keeping this lightweight and repo-free for this challenge, here is the core logic. It relies on openai-whisper for local audio transcription and ollama for local text generation.

import whisper
import ollama
import sys

def create_ofrenda(audio_path):
    print("🕯️  Loading Whisper locally... transcribing the spirits...")
    model = whisper.load_model("base")
    result = model.transcribe(audio_path)
    transcript = result["text"]

    print("🦙 Waking up the local archivist (Llama 3.2)...")
    prompt = f"""You are a compassionate archivist for Día de los Muertos. 
    Based on this memory shared about a loved one, write a beautiful 'Ofrenda Tribute'.
    Include:
    - A poetic title.
    - 3 core life lessons they taught.
    - A short, warm closing blessing.

    Memory: {transcript}
    """

    response = ollama.chat(model='llama3.2', messages=[{'role': 'user', 'content': prompt}])
    print("\n--- 🌼 Ofrenda Tribute ---")
    print(response['message']['content'])
    print("--------------------------")

if __name__ == "__main__":
    create_ofrenda(sys.argv[1])

How I Built It

I built this using Python, OpenAI's Whisper (open-weight speech-to-text), and Ollama running the llama3.2 open-weight LLM.

The pipeline is entirely local. First, the audio file is passed to Whisper, which runs entirely on the CPU/GPU without touching the network. The resulting transcript is then injected into a carefully crafted system prompt designed to honor the deceased, which is passed to the local Ollama daemon. The "ghost in the machine" here is quite literal—the AI is channeling the raw audio of the past into a structured tribute for the present, running entirely on a laptop with the Wi-Fi turned off.

Why Does Open Innovation Matter?

Open innovation is the absolute core of this project for two reasons:

  1. Intimate Privacy: Voice recordings of people crying, remembering the dead, or sharing deeply personal family secrets should never be uploaded to a third-party cloud API. Open-weight models allow this tool to run 100% locally, keeping family grief and memories entirely on the user's own machine.
  2. Permanence: Día de los Muertos is about remembering. If this tool relied on a closed, paid API, what happens when that company goes bankrupt or changes its pricing? The memories become locked. Open-source AI ensures that as long as you have a computer, you can run this tool and access your family's history, free from subscription fees or API deprecation.

My Agent Session

While this isn't a multi-step agentic workflow, the "agent" here acts as a compassionate archivist. I spent time iterating on the prompt in Ollama to ensure the model didn't hallucinate facts, but rather synthesized the emotional core of the transcript into a respectful tribute. Getting the tone right—somber but celebratory—required testing different open-weight models until Llama 3.2 nailed the cultural nuance of an Ofrenda.

The Spirit of It

I tested this with a 3-minute audio clip of my father talking about his own father, who passed away before I was born. Hearing the AI transcribe his voice and then beautifully summarize a man I never met into a printable tribute brought tears to my father's eyes. It didn't just process data; it created a tangible artifact of memory that we placed on our physical Ofrenda this year.

Prize Categories

  • Local-first AI / Privacy-focused AI
  • Best use of Open-Weight Models

來源:DEV Community · dev.to