How ap4549/parkisense works
Project Type & Purpose
• ParkiSense is a Python-based ML application with an interactive UI (Gradio) that provides three core services:
– Keystroke-dynamics prediction
– Voice-analysis prediction
– AI chatbot (Gemini AI)
• It’s primarily a full-stack “one-service” app (UI + inference) with optional offline pipelines for data prep and model training.
High-Level Architecture Components
a. Presentation Layer (Frontend/UI)
– Gradio-based Web UI (Code/app/app.py + home.py)
– PWA shell (service-worker, manifest) in assets/
b. Inference Services (Business Logic)
– Keystroke module (type.py + Pynput)
– Voice module (voice.py + Librosa/Parselmouth)
– Chatbot module (chatbot.py + Gemini AI API)
c. Model & Data Layer
– Pre-trained model files (model/sgd_model.pkl, model/voicemodel.pkl)
– Static data (data/full_set.csv, data/parkinsons.data)
– User recordings & feature CSVs
d. External Services
– Gemini AI API for chatbot responses
e. Offline Pipelines (for reference)
– Jupyter notebooks under Code/ (tappydata_prep.ipynb, tappymodel_train.ipynb, voicetrain.ipynb)
Relationships & Data Flows
• User → Gradio UI:
– Text input → Keystroke module → feature extraction → sgd_model.pkl → prediction → UI
– Audio upload/record → Voice module → feature extraction → voicemodel.pkl → prediction → UI
– Chat query → chatbot module → Gemini AI API → response → UI
• Gradio UI loads models from disk at startup
• Offline pipelines consume raw data from data/Archived-Data → produce models in model/
Architectural Patterns & Principles
• Layered separation:
– Presentation (Gradio)
– Processing (feature-extraction functions)
– Inference (model prediction)
– External integration (Gemini AI)
• Single process with modular Python packages, rather than microservices
• Clear demarcation of online (inference) vs offline (training)
• Keystroke Service (type.py + sgd_model.pkl)
• Voice Service (voice.py + voicemodel.pkl)
• Chatbot Service (chatbot.py → Gemini AI API)
• Data Archive (data/Archived-Data) → Notebooks → model/*.pkl