Issue
I am getting error while importing flask, error message goes as
ImportError: cannot import name 'abort' from 'werkzeug.exceptions'
here is my full code
from flask import Flask,render_template,request,jsonify
from sklearn.preprocessing import StandardScaler
import pickle
app=Flask(__name__)
@app.route('/',methods=['GET','POST'])
def homepage():
print("home")
return render_template("Index.html")
@app.route('/predict',methods=['POST'])
def predict():
print("predict")
preg=int(request.form["PreganciesName"])
glucose=float(request.form["GlucoseName"])
BP=float(request.form["BloodPressureName"])
st=int(request.form["SkinThicknessName"])
insu=float(request.form["InsulinName"])
bmi=float(request.form["BMIName"])
dpf=float(request.form["DPFName"])
age=int(request.form["ageName"])
print("fetching data done")
scaler=StandardScaler()
filename = 'Diabetis with logistic regression.pickle'
loaded_model = pickle.load(open(filename, 'rb'))
print("model loded")
a = loaded_model.predict(scaler.transform([[preg,glucose,BP,st,insu,bmi,dpf,age]]))
print("otput "+str(a))
return render_template('result.html',a[0])
if __name__=="__main__":
app.run(debug=True)
Solution
I guess problem was with python 3.8 version. I reinstalled python 3.6 and it worked. I think it will also work fine for python 3.7
Answered By - GAURAV Sharma
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.