-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
68 lines (53 loc) · 2.08 KB
/
app.py
File metadata and controls
68 lines (53 loc) · 2.08 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from flask import Flask, jsonify, request,render_template
import pickle
from sklearn.preprocessing import StandardScaler
from sklearn.base import BaseEstimator
import pandas as pd
import numpy as np
app = Flask(__name__)
@app.route('/')
def home_page():
return render_template('index.html')
@app.route('/info')
def EnterDetails():
return render_template('Detail.html')
@app.route('/aboutus')
def aboutus():
return render_template('about.html')
@app.route('/contact')
def contact():
return render_template('contact.html')
@app.route('/predict', methods=['POST', 'GET'])
def predict():
try:
if request.method == 'POST':
gre_score = float(request.form['GRE'])
toefl_score = float(request.form['TOFEL'])
university_rating = float(request.form['University'])
sop = float(request.form['SOP'])
lor = float(request.form['LOR'])
cgpa = float(request.form['CGPA'])
research = float(request.form['Research'])
filename = 'model/linear_model.pickle'
load_model = pickle.load(open(filename, 'rb'))
""""
Loading the dataset and loading the features in variable x
"""
df = pd.read_csv("model/Admission_Predict.csv")
df.drop(columns='Serial No.',inplace=True)
x = df.drop(columns=['Chance of Admit '])
"""
we transfored the data using StandardScale to reduce highly correlation
that's we again using StandardScale to pass the Actual data to model
"""
scaler = StandardScaler()
arr = scaler.fit_transform(x)
# print(arr)
data =scaler.transform([[gre_score, toefl_score, university_rating, sop, lor, cgpa, research]])
# Predicting the the result
prediction = load_model.predict(data)
return render_template('output.html', prediction=round(100*prediction[0]))
except Exception as e:
print("the error is : ",e)
if __name__ == '__main__':
app.run(debug=True)