Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions FLASK PROJECTS/Teacher Promotion Flask API/LICENSE

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions FLASK PROJECTS/Teacher Promotion Flask API/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

[requires]
python_version = "3.8"
49 changes: 49 additions & 0 deletions FLASK PROJECTS/Teacher Promotion Flask API/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# teacher-promotion-flask-api
Flask API for teacher promotion. Due to confidentiality agreements, I am unable to disclose the data used for training the model or the three promotion parameters labeled as 1, 2 and 3. However, you are welcome to utilize the API or customize it as needed. Thank you.

## Install Requirements
```bash
pip install -r requirements.txt
```



## Setup
- open the terminal
- clone the repository
```bash
git clone https://github.com/saeedahmadicp/teacher-promotion-flask-api.git
```
- change the directory

```bash
cd teacher-promotion-flask-api
```
- execute the below commands
```bash
pip3 install pipenv
```
```bash
pipenv install
```
```bash
pipenv shell
```

- install the requirements
```bash
pip install -r requirements.txt
```

- execute the following commands
```bash
set FLASK_APP=main.py
```
```bash
set FLASK_ENV=development
```
```bash
flask run
```

- **If you are using Linux or Mac, use `export` instead of `set` in the above commands**
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
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.
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.
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.
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.
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.
1 change: 1 addition & 0 deletions FLASK PROJECTS/Teacher Promotion Flask API/learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import numpy as np
from sklearn.ensemble import RandomForestClassifier
import joblib

def label_encoder(x):
if x == 'M':
return 1
elif x == 'E':
return 2
elif x == 'E+':
return 3
elif x == 'S':
return 4


def process_and_predict(data):
#process the data
data = (np.array(data)).reshape(1, -1)

#load the model
model = joblib.load('model')

#model prediction
prediction = list(model.predict(data))[0]

if prediction == 0:
text = "Not Eligible"
elif prediction == 1:
text = "Eligible"

return text
34 changes: 34 additions & 0 deletions FLASK PROJECTS/Teacher Promotion Flask API/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from flask import Flask, render_template, request, redirect
from load_process_prediction import label_encoder, process_and_predict

#Declaring the flask object
app = Flask(__name__)


#defining the home route
@app.route('/')
def home():
return render_template('index.html')


#defing the result route
@app.route('/result', methods=['GET', 'POST'])
def result():
if request.method == 'POST': #use args if using get method
firstName = request.form['fname']
lastName = request.form['lname']
age = request.form['age']
experience = request.form['experience']
grade = request.form['grade']
lastPromotion = request.form['lpromotion']
promo1 = request.form['promo1']
promo2 = request.form['promo2']
promo3 = request.form['promo3']
data = [age, experience, grade, lastPromotion, label_encoder(promo1), label_encoder(promo2), label_encoder(promo3)]
prediction = process_and_predict(data)

#redirecting the user to the page
return render_template('result.html', firstName=firstName, lastName=lastName, prediction=prediction)
else:
return redirect('/')

16 changes: 16 additions & 0 deletions FLASK PROJECTS/Teacher Promotion Flask API/manual.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pip install -r requirements.txt

1) open the terminal
2) change the working directory to the flask_api
3) execute the below commands
pip3 install pipenv
pipenv install
pipenv shell

4) install the following packages
pip install -r requirements.txt

5) execute the following commands
set FLASK_APP=main.py
set FLASK_ENV=development
flask run
Binary file added FLASK PROJECTS/Teacher Promotion Flask API/model
Binary file not shown.
17 changes: 17 additions & 0 deletions FLASK PROJECTS/Teacher Promotion Flask API/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
click==8.1.3
colorama==0.4.5
et-xmlfile==1.1.0
flashtext==2.7
Flask==2.1.3
importlib-metadata==4.12.0
itsdangerous==2.1.2
Jinja2==3.1.2
joblib==1.1.0
MarkupSafe==2.1.1
numpy==1.23.1
openpyxl==3.0.10
scikit-learn==1.1.1
scipy==1.8.1
threadpoolctl==3.1.0
Werkzeug==2.1.2
zipp==3.8.1
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

149 changes: 149 additions & 0 deletions FLASK PROJECTS/Teacher Promotion Flask API/static/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
body {
font-family: "Roboto", sans-serif;
background-color: #fff; }

p {
color: #b3b3b3;
font-weight: 300; }

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
font-family: "Roboto", sans-serif; }

a {
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease; }
a:hover {
text-decoration: none !important; }

.content {
padding: 7rem 0; }

h2 {
font-size: 20px; }

.half, .half .container > .row {
height: 100vh;
min-height: 900px; }

@media (max-width: 991.98px) {
.half .bg {
height: 200px; } }

.half .contents {
background: #f6f7fc; }

.half .contents {
width: 80%; }

.half .bg {
width: 20%; }

@media (max-width: 991.98px) {
.half .contents, .half .bg {
width: 100%; } }

.half .contents .form-control, .half .bg .form-control {
border: none;
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px;
height: 54px;
background: #fff; }
.half .contents .form-control:active, .half .contents .form-control:focus, .half .bg .form-control:active, .half .bg .form-control:focus {
outline: none;
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1); }

.half .bg {
background-size: cover;
background-position: center; }

.half a {
color: #888;
text-decoration: underline; }

.half .btn {
height: 54px;
padding-left: 30px;
padding-right: 30px; }

.half .forgot-pass {
position: relative;
top: 2px;
font-size: 14px; }

.control {
display: block;
position: relative;
padding-left: 30px;
margin-bottom: 15px;
cursor: pointer;
font-size: 14px; }
.control .caption {
position: relative;
top: .2rem;
color: #888; }

.control input {
position: absolute;
z-index: -1;
opacity: 0; }

.control__indicator {
position: absolute;
top: 2px;
left: 0;
height: 20px;
width: 20px;
background: #e6e6e6;
border-radius: 4px; }

.control--radio .control__indicator {
border-radius: 50%; }

.control:hover input ~ .control__indicator,
.control input:focus ~ .control__indicator {
background: #ccc; }

.control input:checked ~ .control__indicator {
background: #fb771a; }

.control:hover input:not([disabled]):checked ~ .control__indicator,
.control input:checked:focus ~ .control__indicator {
background: #fb8633; }

.control input:disabled ~ .control__indicator {
background: #e6e6e6;
opacity: 0.9;
pointer-events: none; }

.control__indicator:after {
font-family: 'icomoon';
content: '\e5ca';
position: absolute;
display: none;
font-size: 16px;
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease; }

.control input:checked ~ .control__indicator:after {
display: block;
color: #fff; }

.control--checkbox .control__indicator:after {
top: 50%;
left: 50%;
margin-top: -1px;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%); }

.control--checkbox input:disabled ~ .control__indicator:after {
border-color: #7b7b7b; }

.control--checkbox input:disabled:checked ~ .control__indicator {
background-color: #7e0cf5;
opacity: .2; }
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Open *demo.html* to see a list of all the glyphs in your font along with their codes/ligatures.

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

You won't need any of the files located under the *demo-files* directory when including the generated font in your own projects.

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.
Loading