# amruta-katkar/predictcarprice architecture

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

- Interactive diagram: https://gitdiagram.com/amruta-katkar/predictcarprice
- Repository: https://github.com/amruta-katkar/predictcarprice

## Overview

1. **Project type and purpose**
   - This is a small **Python Flask web application** for **car price prediction**.
   - It is not a full ML platform; it is a simple inference app that serves a UI and uses a pre-trained model artifact.

2. **Main runtime boundary**
   - The application is started with **Flask** via `python -m flask --app program run`.
   - `program.py` is the central entry point and likely contains the Flask app object, route handlers, and model-loading logic.

3. **User-facing flow**
   - A browser opens the app and lands on the **home page**.
   - The user can navigate to a **car price prediction form**.
   - After submitting vehicle details, the app returns a **result page** showing the predicted price.

4. **Presentation layer**
   - The `templates/` directory contains the HTML views:
     - `home.html` for the landing page
     - `carpriceprediction.html` for the input form
     - `carpriceresult.html` for displaying the prediction outcome
   - This suggests server-side rendering with Flask’s template engine rather than a separate frontend application.

5. **Application logic layer**
   - `program.py` likely acts as the orchestration layer between:
     - HTTP request handling
     - form input parsing
     - model invocation
     - result rendering
   - The key architectural boundary is between web UI handling and ML inference.

6. **Machine learning inference asset**
   - `LinearRegresionModel.pkl` is a serialized model artifact, likely a scikit-learn regression model used for prediction.
   - This is the core inference dependency and is treated as a deployed artifact rather than being trained at runtime.

7. **Data artifact**
   - `clean_data.csv` appears to be a cleaned dataset used for model training or validation.
   - Based on the repository contents, it is probably not part of the request-time path, but rather an offline asset used to prepare the `.pkl` model.

8. **Likely request/data flow**
   - Browser submits car attributes through the prediction form.
   - Flask receives the request in `program.py`.
   - Input values are transformed into the feature format expected by the model.
   - The loaded `LinearRegresionModel.pkl` produces a predicted price.
   - The result is injected into `carpriceresult.html` and returned to the browser.

9. **Separation of concerns**
   - The repo is split into:
     - **Web layer**: Flask routes and HTML templates
     - **ML artifact layer**: pickled regression model
     - **Data preparation asset**: cleaned CSV
   - There is no evidence of a separate service, database, queue, or API backend.

10. **External dependencies that matter architecturally**
   - **Python** runtime
   - **Flask** for HTTP routing and templating
   - Likely **scikit-learn** or a similar ML library for loading and using the pickled model
   - Jinja2 templating is implied by the `templates/` layout

11. **Operational model**
   - The app is intended to run as a single-process development-style Flask server.
   - There is no sign of containerization, persistence, authentication, or distributed components.

12. **What to show in an architecture diagram**
   - One client/browser node
   - One Flask application node (`program.py`)
   - One model artifact node (`LinearRegresionModel.pkl`)
   - One static data/artifact node (`clean_data.csv`)
   - Three HTML template outputs under the Flask app
   - Arrows from browser to Flask, Flask to model, Flask back to rendered result

13. **Overall architecture summary**
   - This repository is a **monolithic Flask inference app**: a thin web UI wrapped around a pre-trained regression model, with all prediction logic executed server-side and results rendered through templates.

Main entry points: [`program.py`](https://github.com/amruta-katkar/predictcarprice/blob/main/program.py) (Flask app), [`templates/carpriceprediction.html`](https://github.com/amruta-katkar/predictcarprice/blob/main/templates/carpriceprediction.html) (Price form), [`templates/carpriceresult.html`](https://github.com/amruta-katkar/predictcarprice/blob/main/templates/carpriceresult.html) (Result page), [`templates/home.html`](https://github.com/amruta-katkar/predictcarprice/blob/main/templates/home.html) (Home page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["Web app"]
  node_n2["Flask app<br/>entrypoint<br/>[program.py]"]
  node_n3["Home page<br/>template<br/>[home.html]"]
  node_n4["Price form<br/>template"]
  node_n5["Result page<br/>template"]
end

subgraph group_g2["Artifacts"]
  node_n6[("Model file<br/>ml artifact")]
  node_n7["Clean data<br/>dataset<br/>[clean_data.csv]"]
end

node_n1(("Browser<br/>client"))

node_n1 -->|"HTTP requests"| node_n2
node_n2 -->|"renders"| node_n3
node_n2 -->|"renders"| node_n4
node_n2 -->|"renders"| node_n5
node_n2 -->|"loads model"| node_n6
node_n2 -.->|"uses offline data"| node_n7
node_n4 -->|"submits input"| node_n2
node_n2 -->|"prediction result"| node_n5

click node_n2 "https://github.com/amruta-katkar/predictcarprice/blob/main/program.py"
click node_n3 "https://github.com/amruta-katkar/predictcarprice/blob/main/templates/home.html"
click node_n4 "https://github.com/amruta-katkar/predictcarprice/blob/main/templates/carpriceprediction.html"
click node_n5 "https://github.com/amruta-katkar/predictcarprice/blob/main/templates/carpriceresult.html"
click node_n6 "https://github.com/amruta-katkar/predictcarprice/blob/main/LinearRegresionModel.pkl"
click node_n7 "https://github.com/amruta-katkar/predictcarprice/blob/main/clean_data.csv"

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_n2,node_n3,node_n4,node_n5 toneBlue
class node_n6,node_n7 toneAmber
class node_n1 toneNeutral
```

## Components

### Web app

Flask request handling and rendered pages

- [Flask app](https://github.com/amruta-katkar/predictcarprice/blob/main/program.py): entrypoint · Central application entry point and route handlers · `program.py`
- [Home page](https://github.com/amruta-katkar/predictcarprice/blob/main/templates/home.html): template · Landing page rendered by Flask · `templates/home.html`
- [Price form](https://github.com/amruta-katkar/predictcarprice/blob/main/templates/carpriceprediction.html): template · Car details input form · `templates/carpriceprediction.html`
- [Result page](https://github.com/amruta-katkar/predictcarprice/blob/main/templates/carpriceresult.html): template · Displays the predicted car price · `templates/carpriceresult.html`

### Artifacts

Offline data and trained model files

- [Model file](https://github.com/amruta-katkar/predictcarprice/blob/main/LinearRegresionModel.pkl): ml artifact · Serialized regression model used for inference · `LinearRegresionModel.pkl`
- [Clean data](https://github.com/amruta-katkar/predictcarprice/blob/main/clean_data.csv): dataset · Prepared dataset likely used to train or validate the model · `clean_data.csv`

### Other components

- **Browser**: client · User interacts with the Flask site

## Connections

- Browser → Flask app: HTTP requests · Browser requests pages and submits form data
- Flask app → Home page: renders · Serves the landing page
- Flask app → Price form: renders · Serves the prediction form
- Flask app → Result page: renders · Returns the prediction outcome page
- Flask app → Model file: loads model · Deserializes the trained regression artifact for inference
- Flask app → Clean data: uses offline data · Repository data asset associated with model preparation
- Price form → Flask app: submits input · Form posts vehicle attributes back to the Flask app
- Flask app → Result page: prediction result · Injects predicted price into the result template
