seehiong
hdb-price-predictor
Python

A Streamlit web app that predicts Singapore HDB resale flat prices using a pre-trained XGBoost model. Includes an interactive transaction map, light/dark theme toggle, and Docker support for easy deployment.

Last updated Jul 3, 2026
207
Stars
23
Forks
0
Issues
0
Stars/day
Attention Score
51
Language breakdown
No language data available.
โ–ธ Files click to expand
README

๐Ÿ  HDB Resale Price Predictor App

A Streamlit web application that predicts Singapore HDB resale flat prices. This app loads an XGBoost model and necessary data files (scaler, postal code data) directly from its local directory and displays an interactive transaction map hosted externally.

โœจ Features

  • Interactive UI: User-friendly input for property details via Streamlit.
  • Local Model & Data:
- Pre-trained XGBoost model (model.bst) loaded locally. - Data scaler (scaler.joblib) applied for consistent feature scaling. - Postal code data (postal_data.json) for location-based information.
  • Integrated Transaction Map:
- Displays HDB resale transactions on an interactive map via an iframe to an externally hosted HTML file. - Clickable markers show recent transaction details for each block.
  • Responsive Design: Includes CSS adjustments for better viewing on mobile devices.
  • Theme Toggle: Light and Dark mode options.
  • Dockerized: Ready for containerization.

๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ model.bst
โ”œโ”€โ”€ scaler.joblib
โ”œโ”€โ”€ postal_data.json
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

๐Ÿš€ Running Locally

1. Clone the repository

If you are setting this up from a Git repository:

git clone https://github.com/seehiong/hdb-price-predictor-app.git
cd hdb-price-predictor-app

If you have the files directly, ensure all files listed in the "Project Structure" (excluding the map HTML itself from the local app directory) are in your working directory.

2. Install dependencies

It's recommended to use a virtual environment:

python -m venv venv
source venv/bin/activate  # On Windows use venv\Scripts\activate

Then install the required packages:

pip install -r requirements.txt

3. Ensure local required files are present

Verify that app.py, model.bst, scaler.joblib, and postal_data.json are in the current directory.

4. Run the Streamlit app

streamlit run app.py

The application should now be accessible in your web browser, usually at http://localhost:8501.

๐Ÿณ Docker Instructions

1. Build the Docker image

From the project's root directory (where the Dockerfile is located):

docker build -t hdb-predictor-app:latest .

2. Run the Docker container

docker run -p 8501:8501 hdb-predictor-app:latest

The app will be accessible at http://localhost:8501 on your host machine.

(Optional) Tag and Push to a Container Registry (e.g. Docker Hub)

docker tag hdb-predictor-app:latest <dockerhub-username>/hdb-predictor-app:latest
docker push <dockerhub-username>/hdb-predictor-app:latest

๐Ÿ“ˆ Data

  • Model Training Data: Based on historical HDB Resale Flat Prices
  • Data Last Updated (Reference in App): 30-06-2025

๐Ÿ›  Built With

  • Streamlit: For the web application framework.
  • XGBoost: For the prediction model.
  • scikit-learn: For data scaling (StandardScaler).
  • Joblib: For saving/loading the scaler.
  • Pandas & GeoPandas: Used in the notebook/script that generates the map data.
  • Folium: For generating the interactive HTML map (which is then hosted externally).
  • Docker: For containerization.

๐Ÿ“ Notes

The prediction model (model.bst) and scaler (scaler.joblib) must be compatible with the feature engineering implemented in app.py. The hdbresalepricemapclickable.html file is generated by a separate process (e.g., a Jupyter Notebook using Folium) and hosted externally (e.g., on GitHub Pages). The URL to this live map must be correctly configured in app.py.

๐Ÿ“„ Related Blog Post

๐Ÿ‘‰ Deploy KServe on OKE

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท seehiong/hdb-price-predictor ยท Updated daily from GitHub