How mirzayasirabdullahbaig07/breast-cancer-prediction-model works
Project Type and Purpose
• This is a full-stack, single-page web application focused on real-time ML inference.
• The README and file tree show it is a Streamlit app (app.py) that loads a pre-trained model (trained_model.sav) to predict breast cancer risk, with optional offline training scripts in model.py and raw data in data.csv.
File Structure
• Top-level files:
• app.py – Streamlit front-end code, handles routing, UI elements, and calls inference functions.
• model.py – training script (uses Pandas/NumPy, Scikit-learn/TensorFlow) that reads data.csv and saves the model.
• trained_model.sav – serialized model for inference.
• data.csv – UCI dataset, used only in offline training.
• requirements.txt – dependency list for deployment.
• No separate “backend” or microservices: everything runs in one Python process hosted by Streamlit.
README for Additional Insights
• Tech stack: Python 3.9+, Streamlit (UI), NumPy/Pandas (data prep), Scikit-learn/TensorFlow (model), Pickle (serialization).
• Usage flow: User inputs 8 features → click Predict → model inference → display result card.
• No external database beyond data.csv (training only).
a. Main Components
• Browser / Client
• Streamlit Server (app.py)
• Inference Module (code in app.py or imported from model.py)
• Model Storage (trained_model.sav)
• (Offline) Training Module (model.py + data.csv)
• External Dataset Source (UCI)
b. Relationships & Interactions
1. Client (Browser) sends HTTP request via Streamlit UI.
2. Streamlit Server renders input form, collects features.
3. On “Predict,” Streamlit invokes the Inference Module.
4. Inference Module loads trained_model.sav, preprocesses inputs using NumPy/Pandas, computes prediction.
5. Result is returned to the Streamlit Server and rendered to the user.
6. (Optional, offline) Training Module reads data.csv, trains model, writes trained_model.sav.
c. Architectural Patterns & Principles
• Monolithic service with clear separation of concerns:
• UI Layer (Streamlit)
• Business Logic (Inference)
• Data Access (Model file, CSV)
• Single responsibility: app.py is for serving; model.py is for training.
• Light dependency injection: the model file is an external artifact, not hard-coded.
d. Key Technologies & Libraries
• Frontend: Streamlit
• Data Processing: Pandas, NumPy
• ML Frameworks: Scikit-learn, TensorFlow/Keras
• Serialization: Pickle
• Deployment: Streamlit Cloud or similar