-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
36 lines (28 loc) · 1.21 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
from flask import Flask, render_template, request
import pickle
import numpy as np
# Load the Model
filename = 'clf.pkl'
classifier = pickle.load(open(filename, 'rb'))
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict', methods=['POST'])
def predict():
if request.method == 'POST':
creditscore = int(request.form['CreditScore'])
geography = int(request.form['Geography'])
gender = int(request.form['Gender'])
age = int(request.form['Age'])
tenure = int(request.form['Tenure'])
balance = float(request.form['Balance'])
numofproducts = int(request.form['NumOfProducts'])
hascrcard = int(request.form['HasCrCard'])
isactivemember = int(request.form['IsActiveMember'])
estimatedsalary = float(request.form['EstimatedSalary'])
input_data = np.array([[creditscore, geography, gender, age, tenure, balance, numofproducts, hascrcard, isactivemember, estimatedsalary]])
my_prediction = classifier.predict(input_data)
return render_template('result.html', prediction=my_prediction)
if __name__ == '__main__':
app.run(debug=True)