Skip to content

Commit 27bc2a2

Browse files
committed
update
1 parent 13f1f06 commit 27bc2a2

File tree

8 files changed

+75
-0
lines changed

8 files changed

+75
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn app:app
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#app.py
2+
from flask import Flask,request, url_for, redirect, render_template
3+
import pickle
4+
import numpy as np
5+
6+
app = Flask(__name__)
7+
model=pickle.load(open('model.pkl','rb'))
8+
9+
@app.route('/')
10+
def home():
11+
return render_template("index.html")
12+
13+
@app.route('/predict',methods=['POST','GET'])
14+
def predict():
15+
# receive the values send by user in three text boxes thru request object -> requesst.form.values()
16+
17+
int_features = [int(x) for x in request.form.values()]
18+
final_features = [np.array(int_features)]
19+
20+
prediction=model.predict_proba(final_features)
21+
output='{0:.{1}f}'.format(prediction[0][1], 2)
22+
23+
return render_template('index.html', pred='Student passing probability is : {}'.format(output))
24+
25+
if __name__ == '__main__':
26+
app.run(debug=False)
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Flask==1.1.2
2+
gunicorn==19.9.0
3+
itsdangerous==1.1.0
4+
Jinja2==2.11.2
5+
MarkupSafe==1.1.1
6+
Werkzeug==1.0.1
7+
numpy==1.16.6
8+
scipy==1.2.3
9+
scikit-learn>=0.18
10+
matplotlib>=1.4.3
11+
pandas>=0.19
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title> Student Result Prediction </title>
5+
</head>
6+
<body>
7+
8+
<h2>Result Prediction</h2>
9+
<h3>Predict the probability of Student Result(Pass/Fail) </h3>
10+
11+
<form action='/predict' method="post">
12+
<table>
13+
<tr><td> Daily Self Study
14+
<td> <input name="self_study" placeholder="Daily Self Study (in hrs) " >
15+
</tr>
16+
<tr><td> Monthly time spent on Tutorials
17+
<td> <input name="tutorials_montly" placeholder="Time on Tutorials (in hrs)" >
18+
</tr>
19+
<tr>
20+
<td colspan=2 align=center><br><button type="submit">Predict Probability</button>
21+
</tr>
22+
</table>
23+
</form>
24+
25+
<br> {{pred}}<br>
26+
27+
</body>
28+
</html>
29+
Binary file not shown.
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import pickle
2+
import numpy as np
3+
4+
# load the saved model file and use for prediction
5+
logit_model = pickle.load(open('logit_modelp.pkl','rb'))
6+
7+
ex2 = np.array([6.2,3.4,5.4,2.3]).reshape(1,-1)
8+
print ( logit_model.predict(ex2) )

0 commit comments

Comments
 (0)