a b/BE-PROJECT-1MODEL/app1.py
1
from flask import Flask, render_template, request
2
import pickle
3
import numpy as np
4
app = Flask(__name__)
5
6
model = pickle.load(open('model1.pkl', 'rb'))
7
8
@app.route('/')
9
def home():
10
    return render_template('index.html')
11
12
@app.route('/predict', methods=['POST'])
13
def predict():
14
    int_features = [float(x) for x in request.form.values()]
15
    final = np.array(int_features)
16
    example = final.reshape(1, -1)
17
    output = model.predict(example)
18
19
    if(output[0] == 0):
20
        return render_template('index.html', pred='Low Risk')
21
    elif(output[0] == 1):
22
        return render_template('index.html', pred='High Risk')
23
24
25
if __name__ == "__main__":
26
    app.run(host= '127.0.0.1', port=5001, debug=True)
27
28