-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
40 lines (29 loc) · 1.08 KB
/
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
31
32
33
34
35
36
37
from flask import Flask,request,render_template
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from src.pipeline.testing_pipeline import PredictionPipeline
application=Flask(__name__)
app=application
# Create route for home
@app.route("/")
def index():
return render_template("index.html")
@app.route("/predict",methods=['GET','POST'])
def predict_data():
if request.method=='GET':
return render_template("home.html")
else:
prediction_obj=PredictionPipeline(
Age=request.form.get("age"),
Gender=request.form.get("gender"),
Tenure=request.form.get("tenure"),
CreditScore=request.form.get("CreditScore"),
IsActiveMember=request.form.get("IsActiveMember"),
Geography=request.form.get("Geography"),
NumOfProducts=request.form.get("NumOfProducts"),
)
prediction=prediction_obj.predict()
return render_template("home.html",results=prediction[0])
if __name__=="__main__":
app.run(host="0.0.0.0",debug=True)