Skip to content

Commit ee93f60

Browse files
authored
Merge pull request larymak#266 from saeedahmadicp/main
Teacher Promotion Flask API
2 parents e522743 + e50a162 commit ee93f60

File tree

255 files changed

+83211
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+83211
-0
lines changed

FLASK PROJECTS/Teacher Promotion Flask API/LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
8+
[dev-packages]
9+
10+
[requires]
11+
python_version = "3.8"
Lines changed: 49 additions & 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import numpy as np
2+
from sklearn.ensemble import RandomForestClassifier
3+
import joblib
4+
5+
def label_encoder(x):
6+
if x == 'M':
7+
return 1
8+
elif x == 'E':
9+
return 2
10+
elif x == 'E+':
11+
return 3
12+
elif x == 'S':
13+
return 4
14+
15+
16+
def process_and_predict(data):
17+
#process the data
18+
data = (np.array(data)).reshape(1, -1)
19+
20+
#load the model
21+
model = joblib.load('model')
22+
23+
#model prediction
24+
prediction = list(model.predict(data))[0]
25+
26+
if prediction == 0:
27+
text = "Not Eligible"
28+
elif prediction == 1:
29+
text = "Eligible"
30+
31+
return text
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from flask import Flask, render_template, request, redirect
2+
from load_process_prediction import label_encoder, process_and_predict
3+
4+
#Declaring the flask object
5+
app = Flask(__name__)
6+
7+
8+
#defining the home route
9+
@app.route('/')
10+
def home():
11+
return render_template('index.html')
12+
13+
14+
#defing the result route
15+
@app.route('/result', methods=['GET', 'POST'])
16+
def result():
17+
if request.method == 'POST': #use args if using get method
18+
firstName = request.form['fname']
19+
lastName = request.form['lname']
20+
age = request.form['age']
21+
experience = request.form['experience']
22+
grade = request.form['grade']
23+
lastPromotion = request.form['lpromotion']
24+
promo1 = request.form['promo1']
25+
promo2 = request.form['promo2']
26+
promo3 = request.form['promo3']
27+
data = [age, experience, grade, lastPromotion, label_encoder(promo1), label_encoder(promo2), label_encoder(promo3)]
28+
prediction = process_and_predict(data)
29+
30+
#redirecting the user to the page
31+
return render_template('result.html', firstName=firstName, lastName=lastName, prediction=prediction)
32+
else:
33+
return redirect('/')
34+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pip install -r requirements.txt
2+
3+
1) open the terminal
4+
2) change the working directory to the flask_api
5+
3) execute the below commands
6+
pip3 install pipenv
7+
pipenv install
8+
pipenv shell
9+
10+
4) install the following packages
11+
pip install -r requirements.txt
12+
13+
5) execute the following commands
14+
set FLASK_APP=main.py
15+
set FLASK_ENV=development
16+
flask run
Binary file not shown.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
click==8.1.3
2+
colorama==0.4.5
3+
et-xmlfile==1.1.0
4+
flashtext==2.7
5+
Flask==2.1.3
6+
importlib-metadata==4.12.0
7+
itsdangerous==2.1.2
8+
Jinja2==3.1.2
9+
joblib==1.1.0
10+
MarkupSafe==2.1.1
11+
numpy==1.23.1
12+
openpyxl==3.0.10
13+
scikit-learn==1.1.1
14+
scipy==1.8.1
15+
threadpoolctl==3.1.0
16+
Werkzeug==2.1.2
17+
zipp==3.8.1
Binary file not shown.

FLASK PROJECTS/Teacher Promotion Flask API/static/css/bootstrap.min.css

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FLASK PROJECTS/Teacher Promotion Flask API/static/css/bootstrap.min.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FLASK PROJECTS/Teacher Promotion Flask API/static/css/owl.carousel.min.css

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
body {
2+
font-family: "Roboto", sans-serif;
3+
background-color: #fff; }
4+
5+
p {
6+
color: #b3b3b3;
7+
font-weight: 300; }
8+
9+
h1, h2, h3, h4, h5, h6,
10+
.h1, .h2, .h3, .h4, .h5, .h6 {
11+
font-family: "Roboto", sans-serif; }
12+
13+
a {
14+
-webkit-transition: .3s all ease;
15+
-o-transition: .3s all ease;
16+
transition: .3s all ease; }
17+
a:hover {
18+
text-decoration: none !important; }
19+
20+
.content {
21+
padding: 7rem 0; }
22+
23+
h2 {
24+
font-size: 20px; }
25+
26+
.half, .half .container > .row {
27+
height: 100vh;
28+
min-height: 900px; }
29+
30+
@media (max-width: 991.98px) {
31+
.half .bg {
32+
height: 200px; } }
33+
34+
.half .contents {
35+
background: #f6f7fc; }
36+
37+
.half .contents {
38+
width: 80%; }
39+
40+
.half .bg {
41+
width: 20%; }
42+
43+
@media (max-width: 991.98px) {
44+
.half .contents, .half .bg {
45+
width: 100%; } }
46+
47+
.half .contents .form-control, .half .bg .form-control {
48+
border: none;
49+
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
50+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
51+
border-radius: 4px;
52+
height: 54px;
53+
background: #fff; }
54+
.half .contents .form-control:active, .half .contents .form-control:focus, .half .bg .form-control:active, .half .bg .form-control:focus {
55+
outline: none;
56+
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
57+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1); }
58+
59+
.half .bg {
60+
background-size: cover;
61+
background-position: center; }
62+
63+
.half a {
64+
color: #888;
65+
text-decoration: underline; }
66+
67+
.half .btn {
68+
height: 54px;
69+
padding-left: 30px;
70+
padding-right: 30px; }
71+
72+
.half .forgot-pass {
73+
position: relative;
74+
top: 2px;
75+
font-size: 14px; }
76+
77+
.control {
78+
display: block;
79+
position: relative;
80+
padding-left: 30px;
81+
margin-bottom: 15px;
82+
cursor: pointer;
83+
font-size: 14px; }
84+
.control .caption {
85+
position: relative;
86+
top: .2rem;
87+
color: #888; }
88+
89+
.control input {
90+
position: absolute;
91+
z-index: -1;
92+
opacity: 0; }
93+
94+
.control__indicator {
95+
position: absolute;
96+
top: 2px;
97+
left: 0;
98+
height: 20px;
99+
width: 20px;
100+
background: #e6e6e6;
101+
border-radius: 4px; }
102+
103+
.control--radio .control__indicator {
104+
border-radius: 50%; }
105+
106+
.control:hover input ~ .control__indicator,
107+
.control input:focus ~ .control__indicator {
108+
background: #ccc; }
109+
110+
.control input:checked ~ .control__indicator {
111+
background: #fb771a; }
112+
113+
.control:hover input:not([disabled]):checked ~ .control__indicator,
114+
.control input:checked:focus ~ .control__indicator {
115+
background: #fb8633; }
116+
117+
.control input:disabled ~ .control__indicator {
118+
background: #e6e6e6;
119+
opacity: 0.9;
120+
pointer-events: none; }
121+
122+
.control__indicator:after {
123+
font-family: 'icomoon';
124+
content: '\e5ca';
125+
position: absolute;
126+
display: none;
127+
font-size: 16px;
128+
-webkit-transition: .3s all ease;
129+
-o-transition: .3s all ease;
130+
transition: .3s all ease; }
131+
132+
.control input:checked ~ .control__indicator:after {
133+
display: block;
134+
color: #fff; }
135+
136+
.control--checkbox .control__indicator:after {
137+
top: 50%;
138+
left: 50%;
139+
margin-top: -1px;
140+
-webkit-transform: translate(-50%, -50%);
141+
-ms-transform: translate(-50%, -50%);
142+
transform: translate(-50%, -50%); }
143+
144+
.control--checkbox input:disabled ~ .control__indicator:after {
145+
border-color: #7b7b7b; }
146+
147+
.control--checkbox input:disabled:checked ~ .control__indicator {
148+
background-color: #7e0cf5;
149+
opacity: .2; }
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Open *demo.html* to see a list of all the glyphs in your font along with their codes/ligatures.
2+
3+
To use the generated font in desktop programs, you can install the TTF font. In order to copy the character associated with each icon, refer to the text box at the bottom right corner of each glyph in demo.html. The character inside this text box may be invisible; but it can still be copied. See this guide for more info: https://icomoon.io/#docs/local-fonts
4+
5+
You won't need any of the files located under the *demo-files* directory when including the generated font in your own projects.
6+
7+
You can import *selection.json* back to the IcoMoon app using the *Import Icons* button (or via Main Menu → Manage Projects) to retrieve your icon selection.

0 commit comments

Comments
 (0)