How prerit002/predictor_disease works
Project type and purpose
• From the file tree and minimal README, this is a monolithic Python web application (“Predictor_disease”) that uses a pre-trained machine-learning model to predict diseases based on user-submitted symptoms.
• It bundles a Flask (or similar) app (app.py), Jinja2 templates for the UI (templates/), and serialized model artifacts (models/).
File structure
• Top-level files:
• app.py – the main Flask application (routes, request handling, model loading).
• requirements.txt – Python dependencies (Flask, scikit-learn, etc.).
• Directories:
• templates/ – Jinja2 HTML templates (index.html, predict.html, about.html, base.html).
• models/ – pickled artifacts:
– model.pkl (trained ML model)
– label_encoder.pkl (to map model outputs to disease labels)
– symptom_vocab.pkl (vocabulary for converting symptom input to feature vectors)
Extract insights (README)
• The README only provides the project name, but file names imply a symptom-to-disease predictor.
Main components & interactions
a. Components:
• Client (Web browser)
• Web Server / WSGI Gateway (e.g., Gunicorn or Flask’s built-in server)
• Application layer (app.py)
• ML Model artifacts (models/)
• Template Engine (Jinja2 in templates/)
• Optional: Reverse proxy or load balancer in front of the app
b. Data flow / relationships:
1. User opens index.html → selects symptoms → submits form.
2. HTTP POST to Flask route (/predict) in app.py.
3. app.py loads symptom_vocab.pkl to vectorize inputs.
4. model.pkl processes vector -> numeric prediction.
5. label_encoder.pkl maps numeric code → disease name.
6. Flask renders predict.html with the result.
7. Response returns to the user’s browser.
c. Architectural patterns / principles:
• MVC (Model-View-Controller):
• Model: pickled ML artifacts + data preprocessor.
• View: HTML templates.
• Controller: route handlers in app.py.
• Stateless requests: each prediction is computed on-the-fly.
• Single codebase (monolith) with clear separation of concerns.
d. Key technologies:
• Python 3.x
• Flask (web framework)
• Jinja2 (templating)
• scikit-learn (model framework)
• Pickle (artifact serialization)
Detail
• How symptom_vocab.pkl, model.pkl, and label_encoder.pkl feed into the prediction pipeline.