from flask import Flask,request,render_template,redirect import pickle import numpy as np # sample data # app = Flask(__name__) load = pickle.load(open('model.sav','rb')) @app.route('/') def home(): return render_template('index.html') @app.route('/predict',methods=['POST']) def predict(): preg = request.form.get("preg") bmi = request.form.get("bmi") bp = request.form.get("bp") skin = request.form.get("skin") dp = request.form.get("dp") gl = request.form.get("gl") il = request.form.get("il") age = request.form.get("age") features = np.array([[preg,gl,bp,skin,il,bmi,dp,age]]) pred = load.predict(features) if pred == 1 : output = "Yes, you have Diabaties." elif pred == 0: output = "No, you do not have Diabaties." else : output = pred return render_template('index.html',res=output) if __name__ == "__main__": app.run(host="0.0.0.0", port=7860)