Maaz1's picture
Update README.md
10aeb0d verified
metadata
layout: default
title: Real Estate Price Prediction API
description: real estate price prediction tool with web interface
license: apache-2.0
sdk: docker
app_file: app.py
emoji: πŸ“Š
colorFrom: green
colorTo: gray
pinned: true

🏠 Real Estate Price Prediction API

🌟 Project Motto

This project aims to provide an accurate and interactive Real Estate Price Prediction tool. Users can input details such as property location, square footage, number of bedrooms, and bathrooms to get an instant price prediction based on a trained machine learning model.

This API bridges the gap between data science and user-friendly deployment, allowing seamless integration of advanced predictions into real-world applications.


πŸ’‘ How It Works

  1. Data Processing & Model Training

    • A dataset of real estate transactions was cleaned and processed.
    • Key features such as location, total_sqft, bath, and bhk were selected.
    • A Linear Regression model was trained and stored as a .pkl file for deployment.
  2. Prediction Mechanism

    • The trained model is loaded and predicts property prices based on user inputs.
    • Location data is one-hot encoded to handle categorical features.
  3. Interactive Frontend

    • A Flask-powered web app provides an intuitive interface for predictions.
    • Users input details via forms, and results are displayed instantly.
  4. API Integration

    • A /predict endpoint allows developers to integrate the model with other applications.

πŸŽ₯ Watch the Demo(click image belowπŸ‘‡)

Watch on YouTube


πŸ“· Screenshots

Home Page

Home Page

Prediction Results

Prediction Result


πŸ“‚ Project Structure

β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── python-app.yml          # CI/CD workflow configuration
β”œβ”€β”€ data/                           # Dataset directory
β”‚   └── bengaluru_house_prices.csv  # Dataset file for the project
β”œβ”€β”€ models/                         # Saved models and feature names
β”‚   β”œβ”€β”€ feature_names.pkl           # Pickled feature names
β”‚   └── lr_regg.pkl                 # Trained regression model
β”œβ”€β”€ src/                            # Source code for the project
β”‚   β”œβ”€β”€ EDA.py                      # Exploratory Data Analysis script
β”‚   β”œβ”€β”€ model.py                    # Model training and evaluation script
β”‚   └── preprocessing.py            # Data preprocessing logic
β”œβ”€β”€ templates/                      # HTML templates for the Flask web app
β”‚   β”œβ”€β”€ index.html                  # User input form for predictions
β”‚   └── results.html                # Displays prediction results
β”œβ”€β”€ tests/                          # Unit testing for the project
β”‚   β”œβ”€β”€ __init__.py                 # Marks the directory as a package
β”‚   β”œβ”€β”€ test_model.py               # Tests for the model
β”‚   └── test2direct.py              # Additional test script
β”œβ”€β”€ .gitignore                      # Specifies ignored files for Git
β”œβ”€β”€ app.py                          # Flask application entry point
β”œβ”€β”€ main.py                         # Main execution script
β”œβ”€β”€ requirements.txt                # List of dependencies for the project
β”œβ”€β”€ setup.py                        # Setup script for packaging the project
β”œβ”€β”€ README.md                       # Project overview and documentation

πŸš€ Features

  • Accurate Price Predictions using a trained regression model.
  • Interactive Web Interface for user-friendly predictions.
  • API Integration for developers to use the model programmatically.
  • Scalable and Extendable to new locations or additional features.

πŸ› οΈ Installation and Setup

Prerequisites

  • Python 3.8+
  • Flask
  • Pickle

Installation Steps

  1. Clone the repository:
    
    

git clone https://github.com/Maazuddin1/Banglore_RealEstate_forecast-using-CICD-piplines.git
cd Banglore_RealEstate_forecast-using-CICD-piplines


2. Create a virtual environment:  
```bash
python -m venv env
source env/bin/activate  # Linux/Mac
env\Scripts\activate     # Windows
  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Start the Flask application:

    python app.py
    
  3. Open your browser and navigate to http://127.0.0.1:5000/.


🌐 API Usage

Endpoint: /predict

Method: POST
Input (JSON):

{
  "location": "Whitefield",
  "sqft": 1200,
  "bath": 2,
  "bhk": 3
}

Output:

{
  "predicted_price": 94.23 Lakhs
}

πŸ” Model Details

The trained model uses Linear Regression with key features like:

  • total_sqft: Total square footage of the property.
  • bath: Number of bathrooms.
  • bhk: Number of bedrooms.
  • Location: One-hot encoded for categorical support.

πŸ“ˆ Future Enhancements

  • Add support for more advanced machine learning models like Random Forest or XGBoost.
  • Improve UI design with frameworks like Bootstrap.
  • Expand location datasets for better predictions.
  • Add real-time price scraping for dynamic updates.

πŸ–ΌοΈ Visual Workflow

graph TD
A[User Input] --> B[Flask App]
B --> C[Process Input Features]
C --> D[Trained ML Model]
D --> E[Predict Price]
E --> F[Display Results]

🌟 Contributions

Contributions are welcome! Feel free to fork this repository, open issues, or submit pull requests.


πŸ“„ License