This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend
What I Built
Demo
• it runs locally via the
terminal.
Code
import os
from faster_whisper import WhisperModel
import requests
import json
# 1. LOCAL TRANSCRIPTION (Whisper)
def transcribe_audio(audio_path):
print("Transcribing audio locally...")
model = WhisperModel("base", device="cpu", compute_type="int8")
segments, info = model.transcribe(audio_path, beam_size=5)
transcript = " ".join([segment.text for segment in segments])
return transcript
# 2. LOCAL AI PROCESSING (Ollama + Llama 3)
def structure_recipe(raw_transcript):
print("Structuring recipe with local Llama 3...")
url = "http://localhost:11434/api/generate"
system_prompt = (
"You are a helpful culinary archivist. Your job is to take a messy, conversational "
"audio transcript from a grandparent and turn it into a beautifully structured recipe. "
"Extract the Title, a brief heartwarming description, Ingredients with measurements, "
"and Step-by-Step Instructions. Do not add any conversational filler in your final response."
)
payload = {
"model": "llama3",
"prompt": f"{system_prompt}\n\nTranscript: {raw_transcript}",
"stream": False
}
response = requests.post(url, json=payload)
return response.json()['response']
# 3. RUN THE PIPELINE
if __name__ == "__main__":
audio_file = "grandpas_spaghetti_story.mp3"
if os.path.exists(audio_file):
raw_text = transcribe_audio(audio_file)
final_recipe = structure_recipe(raw_text)
with open("heirloom_recipe.md", "w") as f:
f.write(final_recipe)
print("Success! Your structured recipe is ready in heirloom_recipe.md")
else:
print(f"Please place an audio file named '{audio_file}' in this directory.")
How I Built It
• the Voice-to-Recipe Heirloom Kit for Grandpa Joe to preserve his family cooking stories entirely offline.
Why Does Open Innovation Matter?
• open-weight local models keep personal family stories 100% private and run completely free forever without cloud API costs.
Top comments (0)