🧠 MediInsight – Edge AI Medicine Assistant for Elderly MediInsight is an AI-powered Android application designed to help elderly users understand their medicines easily. The app uses OCR and an on-device Large Language Model (LLM) to scan medicine strips and generate contextual explanations without requiring internet access. 🚀 Key Features 📷 OCR-Based Medicine Scanning Extracts medicine name and details from packaging 🧠 On-Device LLM Reasoning Generates contextual explanations Answers natural language questions
📱 Offline Functionality No internet required Privacy-preserving architecture
✍️ Manual Medicine Entry Allows user correction in case of OCR errors
👵 Elder-Friendly Design Simple UI Large readable fonts
🏗 System Architecture
Camera ↓ OCR Module (Text Extraction) ↓ On-Device LLM (Reasoning & Explanation) ↓ User-Friendly Insight Output
Components: Frontend: Android (Kotlin / Jetpack Compose) OCR Engine: (e.g., ML Kit / Tesseract) LLM Engine: On-device quantized Large Language Model Inference: Edge-based local processing
🧠 Why LLM Instead of a Relational Database? Traditional relational databases: Store structured medicine data Perform deterministic lookups Cannot interpret natural language queries MediInsight uses an LLM because: It understands flexible user questions It generates simplified explanations It handles incomplete OCR text It performs contextual reasoning It adapts language for elderly users This enables dynamic interaction rather than static data retrieval.
🔒 Privacy & Edge AI All processing happens locally on the device: No prescription data is sent to the cloud No external API dependency Reduced latency Enhanced data privacy This makes the system suitable for sensitive healthcare scenarios.
⚠ Medical Disclaimer MediInsight provides informational assistance only. It does not replace professional medical advice. Users are advised to consult qualified healthcare professionals for medical decisions.
📊 Future Improvements Drug interaction detection Structured medical database validation (Hybrid RAG approach) Multilingual support Voice-based query input Medicine reminder system Fine-tuned lightweight medical LLM
This is a minimal example showing how to:
- Initialize the RunAnywhere SDK
- Download AI models (LLMs)
- Load models into memory
- Run text generation with streaming responses
- Model Management: Download and load AI models directly in the app
- Real-time Streaming: See AI responses generate word-by-word
- Simple UI: Clean Jetpack Compose interface
- On-Device AI: All inference runs locally on your Android device
./gradlew assembleDebug
# Or open in Android Studio and click Run- Launch the app
- Tap "Models" in the top bar
- Choose a model (we recommend starting with "SmolLM2 360M Q8_0" - only 119 MB)
- Tap "Download" and wait for it to complete
- Once downloaded, tap "Load" on the model
- Wait for "Model loaded! Ready to chat." message
- Type a message in the text field
- Tap "Send"
- Watch the AI response generate in real-time
The app comes pre-configured with two models:
| Model | Size | Quality | Best For |
|---|---|---|---|
| SmolLM2 360M Q8_0 | 119 MB | Basic | Testing, quick responses |
| Qwen 2.5 0.5B Instruct Q6_K | 374 MB | Better | General conversations |
- RunAnywhere Core SDK: Component architecture and model management
- LlamaCpp Module: Optimized llama.cpp inference engine with 7 ARM64 variants
- Kotlin Coroutines: For async operations and streaming
MyApplication (initialization)
↓
ChatViewModel (state management)
↓
ChatScreen (UI layer)
MyApplication.kt- SDK initialization and model registrationChatViewModel.kt- Business logic and state managementMainActivity.kt- UI components and composables
- Android 7.0 (API 24) or higher
- ~200 MB free storage (for smallest model)
- Internet connection (for downloading models)
- Wait a few seconds for SDK initialization
- Tap "Refresh" in the Models section
- Check logcat for initialization errors
- Check internet connection
- Ensure sufficient storage space
- Verify INTERNET permission in AndroidManifest.xml
- Try the smaller model (SmolLM2 360M)
- Close other apps to free memory
- Check that
largeHeap="true"is set in AndroidManifest.xml
- This is normal for on-device inference
- Smaller models run faster
- Performance depends on device CPU
Want to customize this app? Try:
- Add more models - Edit
MyApplication.kt→registerModels() - Customize UI - Edit
MainActivity.ktcompose functions - Add system prompts - Modify message format in
ChatViewModel.kt - Persist chat history - Add Room database or DataStore
- Add model parameters - Explore temperature, top-k, top-p settings
This example app follows the license of the RunAnywhere SDK.