RasaLore AI:飲食文化傳承與過敏原智能工作室
RasaLore AI — Cultural Culinary Heritage & Allergen Intelligence Studio
RasaLore AI 是一款開源、本地優先的飲食文化餐單翻譯與過敏原智能工作室,使用 Google Gemma 2 分析菜式名稱或食譜筆記,生成多語言餐單內容並識別傳統醬料中的隱藏過敏原。工作室支援英語、日語、中文及法語,提供過敏原來源追蹤和廚房核實提示。它亦可輸出 POS 相容 JSON,並生成 A4 黑金雙欄餐桌餐單。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle
🌿 RasaLore AI — Cultural Culinary Heritage Menu & Allergen Intelligence Studio
What I Built
The Real-World Problem
Every year, millions of international travelers visit Southeast Asia seeking authentic culinary experiences. Yet, local food & beverage (F&B) owners—boutique cafes, traditional warungs, and heritage family bistros—face two critical roadblocks when presenting their menus to foreign diners:
- The Tragic Loss of Cultural Nuance: Generic machine translation tools (Google Translate, DeepL) strip the soul out of traditional food. Translating Bali's ceremonial "Bebek Betutu" into "Duck with Spices" or East Java's century-old "Rawon" into "Black Beef Soup" turns rich gastronomic heritage into flat, uninspired cafeteria listings.
- The Deadly Hidden Allergen Blindspot: In traditional Indonesian and Southeast Asian cooking, dangerous allergens lurk inside complex base pastes (bumbu, sambal terasi fermented shrimp paste containing Crustaceans, petis containing shellfish, or emping crackers containing Tree Nuts/Melinjo). A tourist asking "Does this soup contain shellfish?" will be met with a blank stare from waitstaff who only know the soup as beef broth—leading to severe, life-threatening anaphylactic reactions.
- The Small Business Tech Barrier: Local restaurateurs cannot afford $10,000 custom agency retainers or pay variable monthly cloud API subscription fees to translate dynamic seasonal menus. Furthermore, master chefs refuse to upload their proprietary recipes and spice ratios to cloud servers where their intellectual property could be logged.
The Solution: RasaLore AI
RasaLore AI is an open-source, local-first Cultural Menu & Allergen Intelligence Studio. It acts as an AI Culinary Consultant in a Box—a profitable, turnkey Side Hustle that any developer or freelance consultant can run from a laptop.
With RasaLore AI, a consultant can walk into a local bistro, take their raw dish names or kitchen recipe notes, and instantly generate:
- Heritage Storytelling: Culturally nuanced culinary narratives across 4 languages (English, Japanese, Chinese, and French).
- Sensory Flavor Profiles: Visual spice gauges (Fiery, Hot, Medium, Mild, Non-Spicy), primary taste classifications (Deep & Savory, Sweet & Fragrant), and sensory descriptor chips.
-
Deep Allergen Intelligence: Automated identification of implicit/hidden allergens with distinct severity badges (
CRITICAL_WARNINGvs.DIETARY_NOTICE) and precise source ingredient traceability (e.g., "Crustaceans detected within implicit Sambal Terasi"). - Kitchen Verification Alerts: Proactive flags when recipe notes are too sparse, directing waitstaff to double-check with the head chef.
-
Commercial Table Insert Printouts: High-contrast, black-and-gold dual-column A4 printouts styled specifically for restaurant tables using
@media print(AC-011). -
POS-Ready JSON Export: Structured, schema-validated
DishCardModel[]payloads that plug directly into restaurant Point-of-Sale (POS) and digital kiosk systems. - Built-in Side Hustle Margin Calculator: An interactive financial widget proving the economics of the business model in real time.
Demo
- Live Repository: github.com/mochammadqaysa/hf-challenges-week-2
-
Local Interactive Studio: The studio runs locally on
http://localhost:3000with 0 build steps using native Modern ES Modules.
Key Studio Walkthrough:
-
Curated Heritage Presets: Instant, zero-latency (0ms) preview of authentic regional menus:
- Bali Bistro (Bebek Betutu, Sate Lilit Ikan, Lawar Bali, Pisang Rai)
- Warung Nusantara (Rendang Daging Sapi, Rawon Surabaya, Gado-Gado Batavia, Es Cendol Nangka)
- Kopitiam Heritage (Kaya Toast Butter, Laksa Medan, Nasi Lemak Bungkus, Kopi Tubruk Robusta)
- Real-Time Multilingual Switcher: Click between English (EN), Japanese (JA), Chinese (ZH), and French (FR) to watch the narrative seamlessly adapt while preserving allergen flags completely untouched.
- Custom Dish Enrichment: Submit your own local specialty (e.g., "Soto Ayam Madura") and watch the sequential FIFO progress bar analyze the recipe with Google Gemma 2 in real-time.
- Physical Table Insert: Click "🖨️ Print Physical Menu" to preview a commercial-grade A4 black-and-gold table insert ready for restaurant laminating.
- Point-of-Sale Export: Click "💾 Export POS JSON" to download a verified POS-compatible JSON file.
- Side Hustle Commercial Margin Calculator: Adjust the consulting fee slider ($25 - $100) and menus per week to see real-time avoided cloud costs, profit margins, and monthly projections.
Code
The complete source code is open source and hosted on GitHub:
🌿 RasaLore AI — Cultural Culinary Heritage & Allergen Intelligence Studio
Transforming raw culinary recipes into culturally rich multilingual dining experiences with air-gapped allergen intelligence, powered by Google Gemma 2.
🍽️ What is RasaLore AI?
RasaLore AI is an open-source, local-first Cultural Menu Translation & Allergen Intelligence Studio built for culinary entrepreneurs, boutique restaurants, traditional warungs, and hospitality businesses expanding to international diners.
The Problem
Generic translation tools (Google Translate, DeepL) fail catastrophically in culinary applications:
- Loss of Culinary Nuance: Translating "Bebek Betutu" into "Duck with Spices" or "Rawon" into "Black Beef Soup" completely erases the cultural heritage and storytelling behind centuries of tradition.
- Dangerous Hidden Allergen Blindspots: In Southeast Asian cooking, critical allergens lurk in traditional base pastes (bumbu, sambal terasi containing crustaceans, emping containing tree nuts/melinjo, petis containing shrimp). Generic translators ignore these implicit hazards, exposing foreign tourists to life-threatening allergic reactions.
- Cloud API Cost…
Repository Highlights:
-
src/app.js: Studio Application Controller with sequential queue integration and surgical DOM updates. -
src/prompts/gemma-prompts.js: Structured JSON prompt templates tailored specifically for Google Gemma 2 open-weight models. -
src/parsers/json-sanitizer.js: Multi-stage resilient JSON recovery pipeline that strips markdown fences, trims conversational banter, and auto-closes truncated bracket stacks. -
src/queue/fifo-queue.js: Sequential FIFO Queue (concurrency = 1) with per-dish failure isolation (FAILED_ANOMALY). -
src/components/margin-widget.js: Side Hustle financial calculator and avoided cost algorithm. -
src/styles/print.css: Commercial print stylesheet conforming to A4 portrait dual-column layout. -
tests/: Comprehensive automated test suite with 33 passing tests across 5 suites (tests/sanitizer.test.js,tests/queue.test.js,tests/margin.test.js,tests/export.test.js).
How I Built It
The Open-Source AI Engine: Google Gemma 2
At the heart of RasaLore AI is Google Gemma 2 (gemma2:2b / gemma2:9b), running locally and completely offline via Ollama on standard consumer hardware.
Gemma 2 was chosen for three definitive reasons:
- Exceptional Multilingual Understanding in Small Parameter Sizes: Despite running at just 2 billion parameters, Gemma 2 exhibits remarkable sensitivity to Southeast Asian cultural idioms, food ingredients, and regional dialects that other lightweight models often mangle.
-
Air-Gapped Local Inference (
localhost:11434): With Ollama, Gemma 2 runs entirely in memory without requiring an internet connection. Private restaurant recipes and secret spice blends never leave the owner's laptop. - Zero Marginal Token Cost: Running locally means the marginal cost of enriching 1,000 menu items is exactly $0.00, transforming what would be an expensive recurring cloud expense into pure consulting profit.
Headless Architecture Seams & Dual-Mode Inference
To support both local offline execution and remote hackathon evaluation, RasaLore AI implements a clean Inference Adapter Seam:
-
Primary Mode (
LOCAL_OLLAMA): Directly querieshttp://localhost:11434/api/generatewith zero data egress. -
Remote Fallback Mode (
REMOTE_FALLBACK): For hackathon judges or remote testing without local Ollama, the studio features an ephemeral settings drawer powered by the Hugging Face Serverless Inference API (google/gemma-2-2b-it). User tokens are stored strictly insessionStorage(never saved tolocalStorageor transmitted anywhere else), upholding strict zero-leakage security principles (SEC-002).
Architectural Pillars of the Build:
-
Resilient Multi-Stage JSON Sanitizer (
src/parsers/json-sanitizer.js): Lightweight LLMs running in constrained hardware occasionally produce conversational banter, wrap outputs in markdown fences (`json), or truncate unclosed brackets. Our custom multi-stage sanitizer automatically strips preambles, cleans illegal trailing commas, and reconstructs truncated bracket stacks before validating against the strictDishCardModelschema. -
Sequential FIFO Queue & Failure Isolation (
src/queue/fifo-queue.js): Processing multiple dishes in parallel will instantly thrash CPU/RAM on an 8GB laptop. RasaLore AI enforces strict sequential execution (concurrency = 1). If a single dish fails or encounters malformed output, it is isolated into aFAILED_ANOMALYstate with an interactive "Retry Dish" button, allowing the rest of the queue to complete uninterrupted. -
Surgical DOM Updates: Rather than re-rendering the entire card grid during language changes (which causes flickering and destroys state),
CardStudio.updateCardNarrative()surgically targets only the narrative DOM element, keeping allergen badges, flavor chips, and sibling cards rock-solid. -
Zero-Bundler Conformance (
CON-001): The entire application is built using modern native ES Modules (<script type="module">) and Vanilla CSS. It requires zero compilation, zero bundling, and has zero runtimenode_modulesdependencies.
Why Does Open Innovation Matter?
Open innovation is not just a philosophical preference for RasaLore AI—it is the fundamental reason this side hustle can exist as a profitable business.
1. The Economics of the $0.00 Marginal Cost
If this side hustle relied on closed proprietary APIs (like OpenAI GPT-4o or Anthropic Claude 3.5 Sonnet), every dish enrichment would incur token charges, network latency, and billing overhead.
- Auditing a 20-dish menu with multilingual translations across 4 languages requires approximately 30,000 to 50,000 prompt and completion tokens per restaurant.
- Closed APIs create unpredictable recurring costs and vulnerability to price changes or sudden deprecations.
- By utilizing open-weight Google Gemma 2, inference costs drop to $0.00. As our built-in Margin Widget demonstrates, an operator charging $50 per menu and servicing 5 restaurants a week earns $1,082.50 per month at 99.8%+ gross profit margins. Open-source AI transforms a thin-margin software subscription into a high-margin service business.
2. Radical Recipe Privacy & Air-Gapped Trust
Traditional restaurant owners are intensely protective of their trade secrets. When approaching a legacy family restaurant in Bali or Penang, asking them to upload their handwritten grandmother's recipe into an unknown corporate cloud server is an immediate non-starter.
Open innovation allows us to say to the restaurant owner:
"We unplug the Wi-Fi cable before we run the tool. Your secret ingredients never leave this laptop, are never used to train someone else's model, and are never saved to any corporate server."
This air-gapped privacy guarantee is completely impossible with closed commercial APIs, and it is the single most compelling sales argument when closing local clients.
3. Independence from Vendor Lock-In & Arbitrary Restrictions
Closed AI platforms can arbitrarily change terms of service, ban accounts, experience outages, or impose rate limits during critical service hours. Open-weight models belong to the community. Once downloaded, Gemma 2 will run forever on our hardware, immune to server outages, internet disconnects, or third-party corporate decisions.
My First User
To test the viability of this side hustle in the real world, I brought RasaLore AI to its first test user: Ibu Wayan, owner of a boutique coastal warung in Sanur, Bali.
Who She Is
Ibu Wayan runs a traditional warung serving authentic Balinese recipes passed down from her family. With the influx of Australian, European, and East Asian tourists, her paper menu was causing constant friction. Her handwritten English translations were confusing (her award-winning Bebek Betutu was simply labeled "Duck Chicken Flavor"), and her waitstaff struggled to explain what was in the food.
The Problem She Faced
A week prior, an Australian customer with a severe crustacean allergy had a scary allergic reaction after ordering vegetable soup that contained an implicit dollop of fermented shrimp paste (terasi). Ibu Wayan was terrified of repeat incidents but couldn't afford the $1,500 quote from a local branding agency to rewrite and reprint her menus.
The Engagement & Feedback
I ran Ibu Wayan's 8 core dishes through RasaLore AI right at her dining table:
- The Nuance: When she read the English and French narratives generated for Bebek Betutu—describing it as "a sacred Balinese ceremonial feast slow-roasted in banana leaves with rich wangen spice paste"—she was overjoyed: "Yes! That is exactly what my grandmother taught me!"
- The Allergen Catch: RasaLore AI immediately flagged her Sambal Matah and Sayur Urap with CRITICAL: Crustaceans (Source: Terasi) and flagged her peanut sauce with CRITICAL: Peanuts.
- The Deliverable: Within 15 minutes, we generated a clean black-and-gold A4 table insert using the studio's print engine, printed two copies at the local print shop for $2, and slipped them onto her front tables.
Did She Pay?
Yes! Ibu Wayan paid Rp 500,000 (~$32 USD) in cash on the spot for the 8-dish audit and laminated table inserts.
When asked what she would want next, she asked: "Can you put a QR code on the table that opens this in Japanese for my tourists from Tokyo?" (which is now fully supported through our responsive web view!).
Prize Categories
I am officially entering RasaLore AI into the following categories for Hacktoberfest Week 2: Side Hustle:
🌟 Featured Category: Best Use of Gemma
RasaLore AI is built from the ground up around Google Gemma 2 (gemma2:2b and gemma2:9b):
- Engineered structured JSON prompt templates specifically optimized for Gemma 2 instruction formatting (
src/prompts/gemma-prompts.js). - Deep cultural translation and allergen classification executed entirely through Gemma 2's open weights running locally on Ollama and remotely on Hugging Face Serverless.
- Complete resilience engineering (bracket auto-closers, code fence strippers) designed specifically to handle edge-case generation quirks in lightweight open-weight models.
🏆 Overall Winner
RasaLore AI delivers on every dimension of the Week 2 "Side Hustle" prompt:
- Solves a genuine, high-stakes problem for real small businesses.
- Open-source AI is the irreplaceable engine that makes the unit economics work (99.8%+ profit margin).
- Proven in the real world with a paying first customer.
- Impeccable technical execution: 33 automated unit/integration tests with 100% pass rate, zero runtime dependencies, surgical DOM rendering, and production-ready print/POS exports.
Thank you to DEV, Hacktoberfest, and the open-source community for empowering developers to build real-world, sustainable businesses with open innovation!
來源:DEV Community · dev.to