How zaid7821/multiple-disease-prediction-system works
Project Type and Purpose
• This is a single‐page machine-learning web application built with Streamlit. It loads pre-trained models to predict diseases (diabetes, heart disease, Parkinson’s) based on user-entered symptoms.
• It’s packaged in Docker for easy deployment.
File Structure
• Top level:
• Dataset/ : CSV files used to train models
• Models/ : Serialized ML models (.sav)
• DiabPred.ipynb : Notebook for exploratory analysis / model training
• app.py : Streamlit app entry point (the web “frontend” and “backend” in one)
• Dockerfile & requirements.txt : containerization and dependencies
• No separate “frontend” vs “backend” directories; Streamlit handles both UI and request handling.
• Models are file-based; no external database or microservice.
Key README Insights
• Technologies: Python, Streamlit, Docker.
• The user interacts via a browser to a Streamlit server.
• Docker container listens on port 8501.
Main Components
a. User Interface
• Browser / HTTP client
• Shows form fields (symptoms), “Predict” button, and prediction results.
b. Streamlit Application (app.py)
• HTTP server (port 8501)
• UI rendering + input validation
• Prediction controller that orchestrates model loading and inference.
c. Model Loader & Inference Modules
• Python modules that load .sav files from Models/
• Each model (diabetes, heart, parkinsons) encapsulated in its own inference function.
d. Model Artifacts
• Serialized models stored on disk (Models/*.sav)
• Optionally the original datasets (Dataset/*.csv) for retraining or auditing.
e. Docker Container
• Encapsulates the entire Streamlit app, dependencies from requirements.txt, and model artifacts.
f. (Optional) Future Extension Points
• New disease modules (new .sav files + inference code)
• A database service (e.g., PostgreSQL) to store user submissions and logs
• External ML pipeline / scheduler
Relationships and Data Flow
1. User opens browser → sends HTTP GET to Streamlit server in Docker container
2. Streamlit serves the symptom form
3. User inputs symptom values → clicks “Predict” → HTTP POST to same server
4. Streamlit’s prediction controller invokes the appropriate model loader
5. Model loader reads the .sav file from disk → runs inference on input features
6. Inference result (disease probability / class) returned to Streamlit UI
7. Browser renders result
8. (Future) Optionally log request/result to database or file
Architectural Patterns and Design Principles
• Single‐page application pattern using Streamlit (combines UI + business logic)
• Separation of concerns: UI rendering vs. inference code vs. model artifacts
• Containerization (12-factor app): code + config + dependencies + models reside in one Docker image
• Extensibility: add new disease models by dropping new .sav files + adding inference functions
• Container boundary for Docker with port mapping annotated