Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-101
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
Sachith Fernando
2020-101
Commits
e260a85b
Commit
e260a85b
authored
Nov 16, 2020
by
I.K Seneviratne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Committing some basic implementations for automating the student behavior module with SLPES.
.
parent
ed774d47
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
198 additions
and
48 deletions
+198
-48
FirstApp/api.py
FirstApp/api.py
+55
-2
FirstApp/logic/batch_process.py
FirstApp/logic/batch_process.py
+17
-0
FirstApp/templates/FirstApp/template.html
FirstApp/templates/FirstApp/template.html
+1
-0
FirstApp/templates/FirstApp/video_results.html
FirstApp/templates/FirstApp/video_results.html
+100
-34
FirstApp/urls.py
FirstApp/urls.py
+13
-0
integrated_slpes/settings.py
integrated_slpes/settings.py
+12
-12
No files found.
FirstApp/api.py
View file @
e260a85b
...
@@ -11,7 +11,7 @@ each method will return an HttpResponse that allows its data to be rendered into
...
@@ -11,7 +11,7 @@ each method will return an HttpResponse that allows its data to be rendered into
arbitrary media types.
arbitrary media types.
"""
"""
from
random
import
Random
from
MonitorLecturerApp.models
import
LectureRecordedVideo
,
LecturerVideoMetaData
from
MonitorLecturerApp.models
import
LectureRecordedVideo
,
LecturerVideoMetaData
from
MonitorLecturerApp.serializers
import
LectureRecordedVideoSerializer
,
LecturerVideoMetaDataSerializer
from
MonitorLecturerApp.serializers
import
LectureRecordedVideoSerializer
,
LecturerVideoMetaDataSerializer
...
@@ -24,6 +24,7 @@ from .logic import pdf_file_generator as pdf
...
@@ -24,6 +24,7 @@ from .logic import pdf_file_generator as pdf
from
.logic
import
head_gaze_estimation
as
hge
from
.logic
import
head_gaze_estimation
as
hge
from
.logic
import
video_extraction
as
ve
from
.logic
import
video_extraction
as
ve
from
.serializers
import
*
from
.serializers
import
*
from
braces.views
import
CsrfExemptMixin
import
datetime
import
datetime
...
@@ -113,7 +114,8 @@ class LecturerSubjectViewSet(APIView):
...
@@ -113,7 +114,8 @@ class LecturerSubjectViewSet(APIView):
# API for timetables
# API for timetables
class
FacultyTimetableViewSet
(
APIView
):
class
FacultyTimetableViewSet
(
CsrfExemptMixin
,
APIView
):
# authentication_classes = []
def
get
(
self
,
request
):
def
get
(
self
,
request
):
timetable
=
FacultyTimetable
.
objects
.
all
()
.
filter
()
timetable
=
FacultyTimetable
.
objects
.
all
()
.
filter
()
...
@@ -1267,3 +1269,54 @@ class GetLectureGazeCorrelations(APIView):
...
@@ -1267,3 +1269,54 @@ class GetLectureGazeCorrelations(APIView):
return
Response
({
return
Response
({
"correlations"
:
gaze_correlations
"correlations"
:
gaze_correlations
})
})
##### BATCH PROCESS SECTION #####
# perform the student behavior analysis as a batch process
class
BatchProcess
(
APIView
):
def
get
(
self
,
request
):
video_name
=
request
.
query_params
.
get
(
'video_name'
)
video_id
=
request
.
query_params
.
get
(
'video_id'
)
return
Response
({
"response"
:
True
})
# this API will check whether the lecture activity frame groupings exist
class
CheckStudentBehaviorAvailability
(
APIView
):
def
get
(
self
,
request
):
video_name
=
request
.
query_params
.
get
(
'video_name'
)
#
# isActivityExist = LectureActivityFrameGroupings.objects.filter(
# lecture_activity_id__lecture_video_id__video_name=video_name).exists()
#
# isEmotionExist = LectureEmotionFrameGroupings.objects.filter(
# lecture_emotion_id__lecture_video_id__video_name=video_name).exists()
#
# isGazeExist = LectureGazeFrameGroupings.objects.filter(
# lecture_gaze_id__lecture_video_id__video_name=video_name).exists()
isActivityExist
=
bool
(
Random
()
.
randint
(
0
,
2
))
isEmotionExist
=
bool
(
Random
()
.
randint
(
0
,
2
))
isGazeExist
=
bool
(
Random
()
.
randint
(
0
,
2
))
return
Response
({
"isActivityExist"
:
isActivityExist
,
"isEmotionExist"
:
isEmotionExist
,
"isGazeExist"
:
isGazeExist
})
# this API will perform some random task (delete later)
class
TestRandom
(
APIView
):
def
get
(
self
,
request
):
random
=
Random
()
.
randint
(
0
,
100
)
return
Response
({
"response"
:
random
})
\ No newline at end of file
FirstApp/logic/batch_process.py
0 → 100644
View file @
e260a85b
import
requests
def
batch_process
(
video_id
,
video_name
):
# call the activity process
activity_resp
=
requests
.
get
(
'http://127.0.0.1:8000/process-lecture-activity/?lecture_video_name='
+
video_name
+
'&lecture_video_id='
+
video_id
)
# call the emotion process
emotion_resp
=
requests
.
get
(
'http://127.0.0.1:8000/process-lecture-emotion/?lecture_video_name='
+
video_name
+
'&lecture_video_id='
+
video_id
)
# call the gaze process
gaze_resp
=
requests
.
get
(
'http://127.0.0.1:8000/process-lecture-gaze-estimation/?lecture_video_name='
+
video_name
+
'&lecture_video_id='
+
video_id
)
pass
\ No newline at end of file
FirstApp/templates/FirstApp/template.html
View file @
e260a85b
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
<link
rel=
"stylesheet"
href=
"{% static 'FirstApp/css/sb-admin-2.min.css' %}"
>
<link
rel=
"stylesheet"
href=
"{% static 'FirstApp/css/sb-admin-2.min.css' %}"
>
<link
rel=
"stylesheet"
href=
"{% static 'FirstApp/css/slider.css' %}"
>
<link
rel=
"stylesheet"
href=
"{% static 'FirstApp/css/slider.css' %}"
>
<link
href=
"{% static 'FirstApp/vendor/fontawesome-free/css/all.min.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
<link
href=
"{% static 'FirstApp/vendor/fontawesome-free/css/all.min.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
<link
href=
"{% static 'FirstApp/css/snackbar.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
<link
href=
"https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
rel=
"stylesheet"
>
<link
href=
"https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
rel=
"stylesheet"
>
<link
rel=
"stylesheet"
href=
"{% static 'FirstApp/css/all.min.css' %}"
>
<link
rel=
"stylesheet"
href=
"{% static 'FirstApp/css/all.min.css' %}"
>
...
...
FirstApp/templates/FirstApp/video_results.html
View file @
e260a85b
This diff is collapsed.
Click to expand it.
FirstApp/urls.py
View file @
e260a85b
...
@@ -173,6 +173,19 @@ urlpatterns = [
...
@@ -173,6 +173,19 @@ urlpatterns = [
url
(
r'^get-lecture-recorded-video-name/$'
,
api
.
GetLecturerRecordedVideo
.
as_view
()),
url
(
r'^get-lecture-recorded-video-name/$'
,
api
.
GetLecturerRecordedVideo
.
as_view
()),
##### BATCH PROCESS #####
# perform batch process for student behavior
url
(
r'^student-behavior-batch-process/$'
,
api
.
BatchProcess
.
as_view
()),
# check availability for student behavior components
url
(
r'^check-availability/$'
,
api
.
CheckStudentBehaviorAvailability
.
as_view
()),
# perform random task (delete later)
url
(
r'^get-random_number/$'
,
api
.
TestRandom
.
as_view
()),
# routers
# routers
# path('', include(router.urls)),
# path('', include(router.urls)),
path
(
'api-auth/'
,
include
(
'rest_framework.urls'
,
namespace
=
'rest_framework'
))
path
(
'api-auth/'
,
include
(
'rest_framework.urls'
,
namespace
=
'rest_framework'
))
...
...
integrated_slpes/settings.py
View file @
e260a85b
...
@@ -15,20 +15,18 @@ import os
...
@@ -15,20 +15,18 @@ import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
# Quick-start development settings - unsuitable for production
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
# SECURITY WARNING: keep the secret key used in production secret!
# SECRET_KEY = 'typgn#m(t#byxnp#ut@^gfqyh*1doa28gkqu(ap*k4s5!q&oyo' #original one
# SECRET_KEY = 'typgn#m(t#byxnp#ut@^gfqyh*1doa28gkqu(ap*k4s5!q&oyo' #original one
SECRET_KEY
=
'!3-gwi-1#5-4**85xb#z(t-8#ayc#*gguw4v4+fkax4037sp=)'
# exported one
SECRET_KEY
=
'!3-gwi-1#5-4**85xb#z(t-8#ayc#*gguw4v4+fkax4037sp=)'
# exported one
# SECURITY WARNING: don't run with debug turned on in production!
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG
=
True
DEBUG
=
True
ALLOWED_HOSTS
=
[]
ALLOWED_HOSTS
=
[]
# Application definition
# Application definition
INSTALLED_APPS
=
[
INSTALLED_APPS
=
[
...
@@ -36,6 +34,7 @@ INSTALLED_APPS = [
...
@@ -36,6 +34,7 @@ INSTALLED_APPS = [
'AttendanceApp.apps.AttendanceappConfig'
,
'AttendanceApp.apps.AttendanceappConfig'
,
'MonitorLecturerApp.apps.MonitorlecturerappConfig'
,
'MonitorLecturerApp.apps.MonitorlecturerappConfig'
,
'LectureSummarizingApp.apps.LectureSummarizingAppConfig'
,
'LectureSummarizingApp.apps.LectureSummarizingAppConfig'
,
'corsheaders'
,
'django.contrib.admin'
,
'django.contrib.admin'
,
'django.contrib.auth'
,
'django.contrib.auth'
,
'django.contrib.contenttypes'
,
'django.contrib.contenttypes'
,
...
@@ -48,6 +47,7 @@ INSTALLED_APPS = [
...
@@ -48,6 +47,7 @@ INSTALLED_APPS = [
]
]
MIDDLEWARE
=
[
MIDDLEWARE
=
[
'corsheaders.middleware.CorsMiddleware'
,
'django.middleware.security.SecurityMiddleware'
,
'django.middleware.security.SecurityMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
...
@@ -59,6 +59,9 @@ MIDDLEWARE = [
...
@@ -59,6 +59,9 @@ MIDDLEWARE = [
ROOT_URLCONF
=
'integrated_slpes.urls'
ROOT_URLCONF
=
'integrated_slpes.urls'
# adding the CORS attributes
CORS_ALLOW_ALL_ORIGINS
=
True
TEMPLATES
=
[
TEMPLATES
=
[
{
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
...
@@ -78,7 +81,6 @@ TEMPLATES = [
...
@@ -78,7 +81,6 @@ TEMPLATES = [
WSGI_APPLICATION
=
'integrated_slpes.wsgi.application'
WSGI_APPLICATION
=
'integrated_slpes.wsgi.application'
# Database
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
...
@@ -93,7 +95,6 @@ DATABASES = {
...
@@ -93,7 +95,6 @@ DATABASES = {
}
}
}
}
# Password validation
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
...
@@ -112,7 +113,6 @@ AUTH_PASSWORD_VALIDATORS = [
...
@@ -112,7 +113,6 @@ AUTH_PASSWORD_VALIDATORS = [
},
},
]
]
# Internationalization
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
# https://docs.djangoproject.com/en/2.2/topics/i18n/
...
@@ -126,7 +126,6 @@ USE_L10N = True
...
@@ -126,7 +126,6 @@ USE_L10N = True
USE_TZ
=
True
USE_TZ
=
True
# Static files (CSS, JavaScript, Images)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
# https://docs.djangoproject.com/en/2.2/howto/static-files/
...
@@ -137,7 +136,6 @@ STATICFILES_DIRS = [
...
@@ -137,7 +136,6 @@ STATICFILES_DIRS = [
]
]
STATIC_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'assets'
)
STATIC_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'assets'
)
# media files
# media files
MEDIA_URL
=
'/media/'
MEDIA_URL
=
'/media/'
...
@@ -145,7 +143,9 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
...
@@ -145,7 +143,9 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# REST FRAMEWORK
# REST FRAMEWORK
REST_FRAMEWORK
=
{
REST_FRAMEWORK
=
{
'DEFAULT_PERMISSION_CLASSES'
:
[
# 'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated'
,
# 'rest_framework.permissions.IsAuthenticated',
]
# ]
}
'DEFAULT_AUTHENTICATION_CLASSES'
:
[],
\ No newline at end of file
'DEFAULT_PERMISSION_CLASSES'
:
[]
}
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