-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
30 lines (21 loc) · 957 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import numpy as np
import pandas as pd
from flask import Flask, request, render_template
import pickle
app = Flask(__name__)
model = pickle.load(open('model.pkl', 'rb'))
@app.route("/")
def home():
return render_template('index.html')
@app.route('/predict', methods=['POST'])
def predict():
input_data = [float(x) for x in request.form.values()]
variables_data = [np.array(input_data)]
features_name = ['YearBuilt', 'Area', 'NumBedRooms', 'AreaBedroom', 'BedroomCond', 'NumKitch', 'AreaKitch',
'KitchCond', 'Garage', 'GarageArea', 'Electricity', 'AirConditioning', 'NumHearth',
'HouseCondition', 'Pool', 'Garden']
df = pd.DataFrame(variables_data, columns=features_name)
house_price = int(model.predict(df))
return render_template('index.html', prediction_text='The Estimated Price for the House is ₹{}'.format(house_price))
if __name__ == "__main__":
app.run(debug=True)