-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
31 lines (23 loc) · 817 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
from flask import Flask, render_template, request
import config
import pickle
import numpy as np
model = pickle.load(open(config.MODEL_PATH, 'rb'))
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route("/", methods = ['POST'])
def predict():
cgpa = float(request.form.get('cgpa'))
iq = int(request.form.get('iq'))
profile_score = int(request.form.get('profile_score'))
result = model.predict(np.array([cgpa, iq, profile_score]).reshape(1, 3))
print(f"{result}")
if result[0] == 1:
result = "Student will get placed!"
else:
result = "Student will not get placed!"
return render_template('index.html', predictions = result)
if __name__ == "__main__":
app.run(host = config.HOST, port = config.PORT, debug=True)