-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi.py
More file actions
28 lines (22 loc) 路 773 Bytes
/
Copy pathapi.py
File metadata and controls
28 lines (22 loc) 路 773 Bytes
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
from flask import Flask
import pandas as pd
import pickle
app = Flask(__name__)
loaded_pipe = pickle.load(open('/home/bhavesh/Dropout/DropOut-Devils/api/pipeline2.pkl', 'rb'))
def predict_status(input_data):
cols = ['Attendance_Rate', 'GPA', 'Behavioral_Incidents', 'Counselor_Visits',
'Parental_Education', 'Extracurricular_Participation',
'Salary_Category']
x = pd.DataFrame([input_data], columns = cols)
y = loaded_pipe.predict(x)
print('Prediction =', y[0])
return y[0]
@app.route('/api/ml')
def predict():
test1 = [8.23, 9.8, 2, 3, "PhD", 1, "Low"]
result = predict_status(test1)
if (result == 0):
pred = 'This student will not dropout'
else :
pred = 'This student might dropout!!'
return {"name": pred}