Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Code_Data/CodeData

This file was deleted.

1 change: 0 additions & 1 deletion NDV_Code_By_KishoreK_TaxCalculator /TaxCalculator.py

This file was deleted.

13,321 changes: 13,321 additions & 0 deletions NDV_RealEstate_PricePrediction/Bengaluru_House_Data.csv

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions NDV_RealEstate_PricePrediction/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Real Estate Price Prediction - Flask Dashboard

## 🔍 Project Overview
This project is a Flask-based web application that predicts real estate prices in Bangalore based on:
- Location
- Area (in square feet)
- Number of Bedrooms (BHK)
- Number of Bathrooms

The app uses a machine learning model trained on the **Bengaluru House Price Dataset** from Kaggle.

---
34 changes: 34 additions & 0 deletions NDV_RealEstate_PricePrediction/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from flask import Flask, render_template, request
import joblib
import pandas as pd

app = Flask(__name__)
model = joblib.load('real_estate_model.pkl')

@app.route('/')
def home():
return render_template('index.html')

@app.route('/predict', methods=['POST'])
def predict():
location = request.form['location']
area = float(request.form['area'])
bath = int(request.form['bath'])
bhk = int(request.form['bhk'])

# Create a DataFrame with the same columns as during training
input_df = pd.DataFrame([{
'location': location,
'total_sqft': area,
'bath': bath,
'bhk': bhk
}])

# Predict using the trained pipeline
prediction = model.predict(input_df)
output = round(prediction[0], 2)

return render_template('index.html', prediction_text=f'Estimated Price: ₹{output} Lakhs')

if __name__ == '__main__':
app.run(debug=True)
52 changes: 52 additions & 0 deletions NDV_RealEstate_PricePrediction/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import pandas as pd
import joblib
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.preprocessing import OneHotEncoder
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline

def convert_sqft_to_num(x):
try:
if '-' in str(x):
tokens = x.split('-')
return (float(tokens[0]) + float(tokens[1])) / 2
return float(x)
except:
return None

# Load the dataset
data = pd.read_csv('Bengaluru_House_Data.csv')

# Create bhk column
data['bhk'] = data['size'].str.extract('(\d+)').astype(float)

# Clean total_sqft
data['total_sqft'] = data['total_sqft'].apply(convert_sqft_to_num)

# Drop rows with missing/invalid data
data = data.dropna(subset=['location', 'total_sqft', 'bath', 'bhk', 'price'])

# Select features and target
X = data[['location', 'total_sqft', 'bath', 'bhk']]
y = data['price']

# Preprocess location
preprocessor = ColumnTransformer(
transformers=[
('loc', OneHotEncoder(handle_unknown='ignore'), ['location'])
],
remainder='passthrough'
)

# Build and train the pipeline
pipeline = Pipeline(steps=[
('preprocessor', preprocessor),
('model', RandomForestRegressor(n_estimators=100, random_state=42))
])

pipeline.fit(X, y)

# Save the trained model
joblib.dump(pipeline, 'real_estate_model.pkl')
print("✅ Model trained and saved as real_estate_model.pkl")
Binary file not shown.
4 changes: 4 additions & 0 deletions NDV_RealEstate_PricePrediction/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Flask
pandas
scikit-learn
joblib
64 changes: 64 additions & 0 deletions NDV_RealEstate_PricePrediction/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<title>Real Estate Price Predictor</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
padding: 30px;
}
.container {
background-color: #fff;
border-radius: 8px;
padding: 20px;
width: 400px;
margin: auto;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
input[type="text"], input[type="number"], select {
width: 100%;
padding: 8px;
margin: 8px 0 16px;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px;
width: 100%;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<h2>Real Estate Price Prediction</h2>
<form action="/predict" method="post">
<label>Location:</label>
<input type="text" name="location" placeholder="e.g., Whitefield" required>

<label>Area (sq ft):</label>
<input type="number" name="area" required>

<label>Bedrooms (BHK):</label>
<input type="number" name="bhk" required>

<label>Bathrooms:</label>
<input type="number" name="bath" required>

<input type="submit" value="Predict Price">
</form>

{% if prediction_text %}
<h3>{{ prediction_text }}</h3>
{% endif %}
</div>
</body>
</html>
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

1 change: 0 additions & 1 deletion Test/Test

This file was deleted.

20 changes: 0 additions & 20 deletions first.html

This file was deleted.

64 changes: 0 additions & 64 deletions notes

This file was deleted.

28 changes: 0 additions & 28 deletions tags_types.html

This file was deleted.