How hritik21/house-price-predictor works
1. This repository is a small end-to-end house price prediction app with two clear parts: an offline training pipeline and an online Flask serving layer.
2. The training side lives in model.py and uses Data/House_Price.json as the source dataset. Based on the README, the model is intentionally simple: a single-feature linear regression that predicts house price from area.
3. The output of training is persisted to model.pkl. This file is the main boundary between model development and application runtime; the web app does not retrain the model on startup, it loads the saved artifact.
4. The runtime entry point is app.py. It starts a Flask server, loads the serialized model, and exposes the prediction workflow through HTTP.
5. User interaction is handled through templates/index.html, which is the main UI page. The app likely renders a form for entering house area and then displays the predicted price in the same page or a returned view.
6. static/ holds the browser-facing assets for the Flask app, such as styling or images. It is part of the presentation layer, separate from model logic and server logic.
7. The primary data flow is: dataset JSON → training script → trained regression model → pickle artifact → Flask app → HTML form input → model prediction → rendered response.
8. The architecture is intentionally minimal and monolithic: there is no database, message queue, or external API. All persistence is file-based, and all serving happens inside one Flask process.
9. The main technology stack is Python with Flask for web serving, pandas/scikit-learn for data handling and regression training, and pickle for model serialization.
10. For an architecture diagram, the key boundaries to show are: dataset/training inputs, the model artifact, the Flask web application, and the browser UI. The strongest dependency is from app.py to model.pkl, while model.py is only needed to regenerate that artifact.
Main entry points: app.py Flask app · model.py Train model · model.pkl Model pickle · index.html Index page
Components 6
Training
Offline data preparation and model persistence.
- House data · Source JSON used to train the regression model.
Data/House_Price.json - Train model · Builds the house price regression model from the dataset.
model.py - Model pickle · Persisted trained model loaded by the web app at runtime.
model.pkl
Serving
Flask app that loads the trained artifact and serves predictions.
- Flask app · Loads the saved model and exposes prediction requests over HTTP.
app.py
UI
Browser-facing template and static assets.
- Index page · Main page for the prediction form and result display.
templates/index.html - Static assets · Browser-facing styles and other presentation files.
static
Connections 6
- House data → Train model: training data · The model script reads the house price dataset.
- Train model → Model pickle: serialize · Training persists the fitted regression model to disk.
- Model pickle → Flask app: load model · The Flask app deserializes the saved model for inference.
- Flask app → Index page: render view · The server renders the main prediction page.
- Flask app → Static assets: serve assets · The server exposes static presentation files to the browser.
- Index page → Flask app: submit input · The form posts house area input back to the Flask app.