Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
Intelligent English Tutor
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
2023-24-027
Intelligent English Tutor
Commits
c3c6dffe
Commit
c3c6dffe
authored
Feb 07, 2024
by
Udara Rangika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api creation
parent
8b4ad902
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
ProficiencyLevelDetection/app.py
ProficiencyLevelDetection/app.py
+38
-0
No files found.
ProficiencyLevelDetection/app.py
0 → 100644
View file @
c3c6dffe
from
flask
import
Flask
,
request
,
jsonify
import
pickle
import
pandas
as
pd
from
flask_cors
import
CORS
# Import CORS
app
=
Flask
(
__name__
)
CORS
(
app
)
# Load the proficiency model
model_proficiency_path
=
'weights/proficiency-rf.pickle'
with
open
(
model_proficiency_path
,
'rb'
)
as
f
:
model_proficiency
=
pickle
.
load
(
f
)
class_dict_rev
=
{
0
:
'Basic'
,
1
:
'Intermediate'
,
2
:
'Advanced'
}
@
app
.
route
(
'/predict_proficiency'
,
methods
=
[
'POST'
])
def
predict_proficiency
():
try
:
data
=
request
.
get_json
()
sample_json
=
pd
.
DataFrame
(
data
,
index
=
[
0
])
.
values
pred
=
model_proficiency
.
predict
(
sample_json
)[
0
]
predicted_class
=
class_dict_rev
[
pred
]
result
=
{
'predicted_class'
:
predicted_class
}
return
jsonify
(
result
)
except
Exception
as
e
:
return
jsonify
({
'error'
:
str
(
e
)})
if
__name__
==
'__main__'
:
app
.
run
(
debug
=
True
)
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