On-Device MedGemma for Frugal Diagnosis of Malaria and Cervical Cancer in Sub-Saharan Africa.
# MAL-AI — Frugal AI Diagnostic Platform for Africa
A Flutter app for the MedGemma Impact Challenge 2026. Three diagnostic modules -- malaria PPG triage, cervical cancer VIA screening, and blood smear microscopy -- powered by MedGemma 4B multimodal reasoning across three deployment tiers.
## Getting Started
### Prerequisites
- Flutter SDK >= 3.10
- Android device or emulator (API 21+)
- ~3 GB free storage for on-device models (optional)
### Build & Run
```bash
git clone && cd mal-ai-flutter
flutter pub get
flutter run # debug on connected device
flutter build apk # release APK (~131 MB)
```
### On-Device AI Setup (Tier 1)
The app defaults to on-device inference. From the app:
1. Open **Settings** (gear icon) > **Manage Models**
2. The screen shows your device RAM and recommended quantization
3. Tap **Download** on a MedGemma GGUF model (Q4_K_M recommended for most phones)
4. Download the **Multimodal Projector** (mmproj-F16.gguf, ~812 MB) for image analysis
Models are downloaded from HuggingFace and stored in the app's private directory.
### Alternative: Local Hub (Tier 2)
Run MedGemma on a nearby laptop via Ollama:
```bash
ollama run
hf.co
```
In the app, switch to **Local Hub** in Settings and set the URL to `http:// :11434/v1`.
### Alternative: Cloud (Tier 3)
Configure Vertex AI credentials in Settings for cloud-hosted MedGemma 27B.
## Architecture
```
Tier 1: On-Device Tier 2: Local Hub Tier 3: Cloud
llamadart (llama.cpp) --> Ollama on LAN laptop --> Vertex AI
MedGemma 4B + mmproj OpenAI-compatible API Google Cloud
Adaptive GGUF quant 16 GB RAM sufficient Full precision
```
The app auto-selects the best available tier, or the user can choose in Settings.
## Diagnostic Modules
### Malaria Triage
```
Home > Intro > PPG Capture (30s) > Symptoms > MedGemma > Result
```
- Camera-based PPG extracts HR, HRV, estimated hemoglobin, waveform morp …