-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew.py
More file actions
28 lines (19 loc) · 726 Bytes
/
Copy pathnew.py
File metadata and controls
28 lines (19 loc) · 726 Bytes
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
from flask import Flask,render_template,request
import joblib
app=Flask(__name__)
model=joblib.load('house_pricess_model.joblib')
print("model loaded from 'house_pricess_model.joblib")
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict',methods=['POST'])
def predict():
size_sqft=int(request.form['size_sqft'])
bedrooms= int(request.form['bedrooms'])
age_years=int(request.form['age_years'])
features=[[size_sqft,bedrooms,age_years]]
prediction=model.predict(features)[0]
predicted_price=f"{prediction:,.2f}"
return render_template('index.html',prediction=predicted_price)
if __name__=='__main__':
app.run(debug=True)