This is a submission for the Gemma 4 Challenge: Build with Gemma 4
What I Built
Thuna (തുണ) is a voice-first AI health companion that runs 100% offline on Android, built for elderly people in rural India who can't read, can't type, and have no reliable internet.
My grandmother takes diabetes medication daily. One month, the pharmacy changed her tablet strength. She got confused and took double the dose for 30 days. She developed hypoglycemia. Nobody noticed until she started fainting.
My other grandmother has polio — she walks with a walker, lives with chronic pain, and can't access hospitals easily. She can't read English. She gets health advice from neighbors — often wrong, sometimes dangerous.
We live in Poothampara, a rural village in Kerala, India. Internet is limited and unreliable. These aren't edge cases — 240 million elderly people globally manage chronic conditions alone.
Thuna solves this with:
- Voice-first Malayalam interaction — speak naturally, hear responses. No typing, no reading needed.
- Medication safety — tracks exact dosages, detects 15 dangerous drug interactions, prevents overdoses with scheduled TTS reminders
- Health monitoring — say "BP 140/90" or "ഷുഗർ 180" and it saves, tracks trends, alerts on danger
- Prescription scanning — photograph a prescription, Gemma 4 vision extracts all medications
- Companion personality — fights loneliness by talking about movies, cooking, family. Offers to call family members.
- Family status sharing — one tap sends daily health update to family WhatsApp
- Health report — structured summary for doctor/health worker visits
- SOS emergency — one-tap call for help
Demo
APK Download: Google Drive
Code
AbinjithTK
/
Thuna
Offline AI Health Companion for the Elderly — Gemma 4 on-device via Cactus
Thuna (തുണ) — Your Health Companion
Offline AI health assistant for elderly people in remote areas, powered by Gemma 4 E2B on-device.
Quick Start
npm install
npx react-native run-android
Architecture
Voice/Text Input → IntentParser (deterministic) → AgentEngine (DB ops) → Gemma 4 E2B (response) → Malayalam TTS
- IntentParser: Regex-based extraction for medications, vitals, conditions, lab results (100% reliable)
- AgentEngine: Executes tools against WatermelonDB (save_vital, save_medication, schedule_reminder, etc.)
- Gemma 4 E2B: Generates natural Malayalam responses only (not used for data extraction)
- Cactus v1.7: On-device inference engine with zero-copy memory mapping
Tech Stack
| Layer | Technology |
|---|---|
| LLM | Gemma 4 E2B INT4 via Cactus v1.7 |
| STT | Cactus Whisper (Malayalam) + Android SpeechRecognizer |
| TTS | Android TextToSpeech (ml-IN) |
| Database | WatermelonDB + openEHR Flat JSON |
| Framework | React Native 0.82 (New Architecture) |
| Navigation | React Navigation 7 (tabs + stack) |
Features
- Voice-first Malayalam interaction
- BP, sugar, SpO2, temperature, heart rate tracking with critical alerts
- Medication…
How I Used Gemma 4
Model: Gemma 4 E2B (2B effective parameters, INT4 quantization via Cactus v1.7)
Why E2B?
My grandmother's phone has 6GB RAM. The E2B INT4 model fits in ~1.5GB, runs inference in ~2 seconds, and works completely offline. In Poothampara, internet drops for hours. A cloud API would be useless. Gemma 4 E2B running on-device through Cactus means the app works every single time — no connectivity required.
What Gemma 4 does in Thuna:
Malayalam response generation — warm, conversational responses in the user's native language. The system prompt is entirely in Malayalam with explicit grammar rules and examples.
Multimodal prescription OCR — user photographs a prescription → Gemma 4 vision extracts medication names, dosages, frequencies → all saved with auto-reminders. One photo replaces 10 minutes of confused explanation.
Companion conversation — talks about anything (movies, cooking, memories). Detects loneliness and offers to call family. This is what makes it a companion, not just a health tool.
Context-aware responses — uses conversation history to give personalized, relevant answers.
What Gemma 4 does NOT do (intentionally):
Health data extraction (BP values, medication names, dosages) uses a deterministic regex parser — not the LLM. Why? My grandmother's overdose happened because of confusion. A regex will NEVER confuse "2mg twice daily" with "two 2mg tablets." For health-critical data, reliability beats flexibility. Gemma 4 handles the warmth; regex handles the precision.
Architecture:
Voice → Regex IntentParser (<1ms, 100% reliable) → AgentEngine (23 tools, DB ops) → Gemma 4 E2B (Malayalam response) → TTS
This hybrid approach gives us the best of both: instant reliable tool execution + warm natural conversation.
Technical highlights:
- 23 agent tools (save_vital, drug_interaction_check, schedule_reminder, prescription_ocr, compound_risk_alert, etc.)
- WatermelonDB with openEHR standard for health records
- Post-processing filter strips Hindi/Manglish from model output
- In-app TTS reminder system that speaks Malayalam at scheduled times
- Proactive health alerts (diabetes + high sugar + high BP = critical warning)
- FHIR R4 cloud sync when internet is available (optional)
Built and tested with my actual grandmother in our village. When she said "ഷുഗർ ഗുളിക കഴിച്ചു" (took sugar tablet) and Thuna confirmed in Malayalam, she understood immediately. That's the moment I knew it worked.
Top comments (0)