Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-049
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-049
2021-049
Commits
1a847d63
Commit
1a847d63
authored
Nov 24, 2021
by
Hasitha Samarasekara
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'IT18058338' into 'master'
It18058338 See merge request
!23
parents
bb220b77
ecf63a83
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
0 deletions
+48
-0
FlaskAPI/review_prediction/app/g3_model.pkl
FlaskAPI/review_prediction/app/g3_model.pkl
+0
-0
FlaskAPI/review_prediction/app/grade_model.pkl
FlaskAPI/review_prediction/app/grade_model.pkl
+0
-0
FlaskAPI/review_prediction/app/main.py
FlaskAPI/review_prediction/app/main.py
+48
-0
FlaskAPI/review_prediction/app/passfail_model.pkl
FlaskAPI/review_prediction/app/passfail_model.pkl
+0
-0
No files found.
FlaskAPI/review_prediction/app/g3_model.pkl
0 → 100644
View file @
1a847d63
File added
FlaskAPI/review_prediction/app/grade_model.pkl
0 → 100644
View file @
1a847d63
File added
FlaskAPI/review_prediction/app/main.py
View file @
1a847d63
...
...
@@ -13,6 +13,14 @@ import pickle
print
(
'Loading Model ...'
)
model
=
keras
.
models
.
load_model
(
'app/model.h5'
)
# marks prediction model
model1
=
pickle
.
load
(
open
(
'app/g3_model.pkl'
,
'rb'
))
# pass/fail prediction model
model2
=
pickle
.
load
(
open
(
'app/passfail_model.pkl'
,
'rb'
))
# grade prediction model
model3
=
pickle
.
load
(
open
(
'app/grade_model.pkl'
,
'rb'
))
print
(
'Model Loaded'
)
# Enabling Cors
...
...
@@ -166,3 +174,43 @@ def review_prediction_for_tutor():
return
jsonify
({
"result"
:
finalyPrecentage
})
#------------------------- IT18058338 Flask API Routes ------------------------------
@
app
.
route
(
'/predict_quiz_marks'
,
methods
=
[
'POST'
])
def
predict_quiz_marks
():
data
=
request
.
get_json
(
force
=
True
)
print
(
"json values - marks"
)
print
(
data
.
values
())
prediction
=
model1
.
predict
([
np
.
array
(
list
(
data
.
values
()))])
# output = prediction[0]
output
=
round
(
prediction
[
0
],
2
)
print
(
output
)
return
jsonify
(
output
)
@
app
.
route
(
'/predict_pass_fail'
,
methods
=
[
'POST'
])
def
predict_pass_fail
():
data
=
request
.
get_json
(
force
=
True
)
print
(
"json values - status"
)
print
(
data
.
values
())
prediction
=
model2
.
predict
([
np
.
array
(
list
(
data
.
values
()))])
output
=
prediction
[
0
]
# output = round(prediction[0],2)
print
(
output
)
return
jsonify
(
int
(
output
))
@
app
.
route
(
'/predict_grade'
,
methods
=
[
'POST'
])
def
predict_grade
():
data
=
request
.
get_json
(
force
=
True
)
print
(
"json values - grade"
)
print
(
data
.
values
())
prediction
=
model3
.
predict
([
np
.
array
(
list
(
data
.
values
()))])
output
=
prediction
[
0
]
print
(
output
)
return
jsonify
(
str
(
output
))
FlaskAPI/review_prediction/app/passfail_model.pkl
0 → 100644
View file @
1a847d63
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment