# hritik21/house-price-predictor architecture

> Architecture diagram of the GitHub repository hritik21/house-price-predictor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hritik21/house-price-predictor
- Repository: https://github.com/hritik21/house-price-predictor

## Overview

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`](https://github.com/hritik21/house-price-predictor/blob/master/app.py) (Flask app), [`model.py`](https://github.com/hritik21/house-price-predictor/blob/master/model.py) (Train model), [`model.pkl`](https://github.com/hritik21/house-price-predictor/blob/master/model.pkl) (Model pickle), [`templates/index.html`](https://github.com/hritik21/house-price-predictor/blob/master/templates/index.html) (Index page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Training"]
  node_dataset["House data<br/>dataset<br/>[House_Price.json]"]
  node_trainer["Train model<br/>training script<br/>[model.py]"]
  node_artifact[("Model pickle<br/>serialized model<br/>[model.pkl]")]
end

subgraph group_runtime["Serving"]
  node_app["Flask app<br/>web server<br/>[app.py]"]
end

subgraph group_presentation["UI"]
  node_template["Index page<br/>html template<br/>[index.html]"]
  node_static{{"Static assets"}}
end

node_dataset -->|"training data"| node_trainer
node_trainer -->|"serialize"| node_artifact
node_artifact -->|"load model"| node_app
node_app -->|"render view"| node_template
node_app -->|"serve assets"| node_static
node_template -->|"submit input"| node_app

click node_dataset "https://github.com/hritik21/house-price-predictor/blob/master/Data/House_Price.json"
click node_trainer "https://github.com/hritik21/house-price-predictor/blob/master/model.py"
click node_artifact "https://github.com/hritik21/house-price-predictor/blob/master/model.pkl"
click node_app "https://github.com/hritik21/house-price-predictor/blob/master/app.py"
click node_template "https://github.com/hritik21/house-price-predictor/blob/master/templates/index.html"
click node_static "https://github.com/hritik21/house-price-predictor/tree/master/static"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset,node_trainer,node_artifact toneBlue
class node_app toneAmber
class node_template,node_static toneMint
```

## Components

### Training

Offline data preparation and model persistence.

- [House data](https://github.com/hritik21/house-price-predictor/blob/master/Data/House_Price.json): dataset · Source JSON used to train the regression model. · `Data/House_Price.json`
- [Train model](https://github.com/hritik21/house-price-predictor/blob/master/model.py): training script · Builds the house price regression model from the dataset. · `model.py`
- [Model pickle](https://github.com/hritik21/house-price-predictor/blob/master/model.pkl): serialized model · 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](https://github.com/hritik21/house-price-predictor/blob/master/app.py): web server · Loads the saved model and exposes prediction requests over HTTP. · `app.py`

### UI

Browser-facing template and static assets.

- [Index page](https://github.com/hritik21/house-price-predictor/blob/master/templates/index.html): html template · Main page for the prediction form and result display. · `templates/index.html`
- [Static assets](https://github.com/hritik21/house-price-predictor/tree/master/static): assets · Browser-facing styles and other presentation files. · `static`

## Connections

- 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.
