A web-based, multi-modal AI prototype for early Alzheimer’s risk screening using three types of user input:
- Audio (speech) → WaveNet-style deep model (PyTorch) + acoustic feature fallback
- Text (symptoms description) → engineered clinical-style features → SVM classifier (scikit-learn)
- Image (medical image upload) → lightweight computer-vision feature extraction → SVM classifier (scikit-learn)
Important: This project provides an AI-powered risk assessment and must not be used as a medical diagnosis. Always consult qualified healthcare professionals.
- Project Overview
- Features
- How It Works (Pipeline)
- Tech Stack
- Repository Structure
- Quick Start (Run Locally)
- API Documentation
- Models & Artifacts
- Frontend UI Guide
- Notes, Limitations, and Safety
- License
Alvira is an Alzheimer’s early detection platform built as a full-stack application:
- Frontend (React + Vite) provides a friendly UI to upload image, audio, or enter text symptoms.
- Backend (Flask) exposes an API endpoint that performs inference using pre-trained models and preprocessing artifacts included in the repository.
The system returns:
- Risk level:
Low/Medium/High - Confidence (percentage)
- Recommendations (actionable guidance)
- For audio: an additional predicted class label (Healthy / Alzheimer / Parkinson)
- Multi-tab UI for:
- Image upload (JPG/PNG/GIF)
- Audio upload (WAV/MP3/M4A/FLAC)
- Symptom text input
- Real-time API-based inference (
POST /api/predict) - Built-in recommendation generation based on predicted risk
- Health endpoint to verify model loading (
GET /api/health)
High-level flow:
User Input → Feature Extraction → Model Inference → Risk Level + Confidence + Recommendations
- Audio is decoded from Base64 and written temporarily as a
.wavfile. - Resampled/loaded at 16 kHz and padded/truncated to a fixed length.
- If
wn_model.pthis available:- A WaveNet-style 1D CNN + attention classifier predicts:
Healthy,Alzheimer, orParkinson
- A WaveNet-style 1D CNN + attention classifier predicts:
- If the audio model is unavailable or errors occur:
- A rule-based fallback computes approximate acoustic measures (e.g., jitter/shimmer proxies, MFCC variance) and returns a best-effort result.
- The backend parses the symptom text to infer fields like:
- Age (if mentioned)
- Education (heuristic based on keywords)
- MMSE/CDR (if present; otherwise defaults + symptom-based adjustments)
- These are converted into a structured feature vector (DataFrame) used by the SVM pipeline.
- The backend decodes the image (Base64), converts to grayscale if needed, then computes simple features:
- intensity statistics, histogram bins, edges, texture variance
- The code then builds a clinical-style feature vector (with some default assumptions) and sends it through the same SVM pipeline.
- React 18, React Router
- Vite
- Tailwind CSS (with PostCSS + Autoprefixer)
- UI/UX:
framer-motionanimationsreact-dropzonefor uploadsreact-hot-toastnotificationslucide-reacticons
- Flask + Flask-CORS
- scikit-learn (SVM + preprocessing artifacts)
- PyTorch (audio model)
- librosa (audio loading)
- OpenSMILE (acoustic feature extraction support)
- OpenCV + Pillow (image processing)
Typical important files/folders in this repo:
README.md— documentationstart.sh— startup helper scriptbackend/app.py— Flask API (prediction + health)audio_processor.py— audio model + processing pipelinerequirements.txt— Python dependencies
src/— React source codepages/Prediction.jsx— main prediction UI (image/audio/text)components/Navbar.jsx— navigationpages/Home.jsx,pages/About.jsx,pages/Guidance.jsx,pages/Map.jsx— additional UI pages
- Model artifacts (repo root):
svm_alzheimer_model.pklscaler.pklpca.pkllabel_encoder.pklwn_model.pth
- Node.js (recommended: 18+)
- Python (recommended: 3.9+)
- Optional but recommended:
- A Python virtual environment (venv/conda)
- System dependencies required by
opencv-python/opensmiledepending on your OS
From the repository root:
npm installRun the frontend dev server:
npm run devVite will show a local URL (commonly http://localhost:5173).
Install Python dependencies:
cd backend
pip install -r requirements.txtNote: If you’re on a system-managed Python (some Linux distros), you might see the project using:
pip install -r requirements.txt --break-system-packagesUse that only if you understand the implications; virtualenv is safer.
Start the Flask backend:
python3 app.pyBackend runs on:
http://127.0.0.1:8000
The frontend expects the backend at:
http://localhost:8000/api/predict
So ensure:
- Backend is running on port 8000
- Frontend is running (Vite dev server)
GET /api/health
Returns whether models were loaded successfully, for example:
- SVM model loaded
- scaler / PCA / label encoder loaded
- audio processor initialized
POST /api/predict
Request JSON
{
"type": "image" | "audio" | "text",
"data": "<base64-data-url OR plain text>"
}- For image:
datashould be a Data URL string likedata:image/png;base64,... - For audio:
datashould be a Data URL string likedata:audio/wav;base64,... - For text:
datais plain text (symptom description)
Response (success)
{
"success": true,
"prediction": {
"risk": "Low|Medium|High",
"confidence": 82.5,
"recommendations": ["..."],
"model_used": "SVM Alzheimer Model|WaveNet Audio Model|Rule-based Audio Analysis",
"input_type": "image|audio|text",
"audio_prediction": "Healthy|Alzheimer|Parkinson"
}
}
audio_predictionis typically present for audio predictions.
curl -X POST http://localhost:8000/api/predict \
-H "Content-Type: application/json" \
-d '{"type":"text","data":"Age 72. Memory loss and confusion. Difficulty with daily tasks."}'For image/audio, the easiest way is to use the web UI (it automatically converts the file to Base64 Data URL).
This repository includes pre-trained artifacts:
svm_alzheimer_model.pkl— SVM classifier used for image and text feature vectorsscaler.pkl— feature scalingpca.pkl— PCA transformationlabel_encoder.pkl— maps class indices to labels (e.g., Nondemented/Converted/Demented)wn_model.pth— PyTorch audio classifier weights
The prediction workflow is implemented in:
src/pages/Prediction.jsx
The UI provides three tabs:
- Upload Image
- Upload Audio
- Enter Symptoms
When the user clicks Get Prediction, the frontend calls:
POST http://localhost:8000/api/predict
…and displays:
- Risk badge (Low/Medium/High)
- Confidence bar
- Recommendations
- (Audio only) predicted label: Healthy / Alzheimer / Parkinson
- Not a diagnostic tool: This is a research/prototype-style implementation.
- Image pipeline is heuristic: The image feature extraction is lightweight and uses some default clinical assumptions; it is not a full medical-imaging diagnostic workflow.
- Text parsing is heuristic: Symptoms are converted into features using rules/regex and defaults.
- Audio processing relies on environment support:
opensmileandopencv-pythonmay require additional system libraries depending on OS.
- Privacy: If you deploy this publicly, you must handle sensitive health data responsibly (consent, security, and compliance).
MIT License