-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
32 lines (23 loc) · 840 Bytes
/
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
# import imp
# from pyexpat import model
from flask import Flask, render_template,request
import pickle
import numpy as np
app= Flask(__name__)
# m= pickle.load(open("model_pickle","rb"))
with open("titanicaccuratemodel.pkl" , "rb") as f:
mp = pickle.load(f)
@app.route("/")
def hello():
return render_template("titanic.html")
@app.route("/predicts",methods=["POST","GET"])
def predicts():
int_features= [int(x) for x in request.form.values()]
final=[np.array(int_features)]
prediction= mp.predict(final)
if prediction == np.array([[1]]):
return render_template("titanic.html", pred="You would not have died!")
if prediction == np.array([[0]]):
return render_template("titanic.html", pred="ALAS! You would have died!")
if __name__=="__main__":
app.run(debug=True, threaded=True)