-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathweb.py
25 lines (21 loc) · 788 Bytes
/
web.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
import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle
app = Flask(__name__)
model =pickle.load(open('SVC_model.pkl', 'rb'))
@app.route('/')
def homepage():
return render_template('diabetes.html')
@app.route('/predict',methods=['POST'])
def predict():
try:
features = [np.array([x for x in request.form.values()])]
print(features)
prediction = model.predict(features)
print(prediction)
output ="Diabetic !" if prediction[0]==1 else "Normal !"
return render_template('diabetes.html', prediction_text='The Patient is {}'.format(output))
except:
return render_template('diabetes.html', prediction_text="Invalid Input!")
if __name__ == "__main__":
app.run(debug=True)