|
--- |
|
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π) |
|
|
|
[](https://www.youtube.com/watch?v=NcmXkE907io) |
|
|
|
|
|
--- |
|
|
|
## π· **Screenshots** |
|
### Home Page |
|
 |
|
|
|
### Prediction Results |
|
 |
|
|
|
--- |
|
|
|
## π **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: |
|
```bash |
|
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 |
|
``` |
|
|
|
3. Install dependencies: |
|
```bash |
|
pip install -r requirements.txt |
|
``` |
|
|
|
4. Start the Flask application: |
|
```bash |
|
python app.py |
|
``` |
|
|
|
5. Open your browser and navigate to `http://127.0.0.1:5000/`. |
|
|
|
--- |
|
|
|
## π **API Usage** |
|
|
|
### Endpoint: `/predict` |
|
**Method**: `POST` |
|
**Input** (JSON): |
|
```json |
|
{ |
|
"location": "Whitefield", |
|
"sqft": 1200, |
|
"bath": 2, |
|
"bhk": 3 |
|
} |
|
``` |
|
|
|
**Output**: |
|
```json |
|
{ |
|
"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** |
|
```mermaid |
|
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** |
|
- |
|
--- |