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
bcdeadae
Commit
bcdeadae
authored
Jan 08, 2021
by
SohanDanushka
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/QA_RELEASE' into db_and_monitoring_IT17097284
parents
03720152
df06d2d8
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
483 additions
and
6 deletions
+483
-6
FirstApp/api.py
FirstApp/api.py
+21
-1
FirstApp/automation_process.py
FirstApp/automation_process.py
+128
-0
FirstApp/logic/batch_process.py
FirstApp/logic/batch_process.py
+6
-4
FirstApp/templates/FirstApp/Home.html
FirstApp/templates/FirstApp/Home.html
+325
-1
FirstApp/urls.py
FirstApp/urls.py
+3
-0
No files found.
FirstApp/api.py
View file @
bcdeadae
...
...
@@ -17,7 +17,7 @@ from MonitorLecturerApp.models import LectureRecordedVideo, LecturerVideoMetaDat
from
MonitorLecturerApp.serializers
import
LectureRecordedVideoSerializer
,
LecturerVideoMetaDataSerializer
from
rest_framework.views
import
*
from
.logic
import
activity_recognition
as
ar
from
.
import
emotion_detector
as
ed
from
.
import
emotion_detector
as
ed
,
automation_process
as
ap
from
.logic
import
id_generator
as
ig
from
.logic
import
pdf_file_generator
as
pdf
from
.logic
import
head_gaze_estimation
as
hge
...
...
@@ -1647,3 +1647,23 @@ class DisplayUpcomingLecturesAPI(APIView):
"subject_code"
:
subject_code
,
})
# this API will handle all the batch processes and video/audio saving to the system
class
AutomationProcess
(
APIView
):
def
get
(
self
,
request
):
return
Response
({
"response"
:
"This API will be used for Automation process"
})
def
post
(
self
,
request
):
lecturer
=
request
.
data
[
'lecturer'
]
subject
=
request
.
data
[
'subject'
]
subject_code
=
request
.
data
[
'subject_code'
]
video_length
=
request
.
data
[
'video_length'
]
processed
=
ap
.
automation_process
(
lecturer
=
lecturer
,
subject
=
subject
,
subject_code
=
subject_code
,
video_length
=
video_length
)
return
Response
({
"is_processed"
:
processed
})
\ No newline at end of file
FirstApp/automation_process.py
0 → 100644
View file @
bcdeadae
import
requests
import
json
from
.
logic
import
batch_process
as
bp
from
MonitorLecturerApp.logic
import
lecturer_batch_process
as
lbp
import
datetime
# this method will save the lecture video
#
# def save_student_lecture_video(student_video):
#
# data_dumps = json.dumps(student_video)
#
# headers = {
# 'Content-Type': 'application/json'
# }
#
# # call the API
# # student_video_save_resp = requests.post('http://127.0.0.1:8000/lecture-video', student_video)
# student_video_save_resp = requests.post(url='http://127.0.0.1:8000/lecture-video', data=data_dumps, headers=headers)
#
# data = student_video_save_resp.json()
#
# return data[0]
#
#
# # this method will save the lecturer video details
# def save_lecturer_video_details(video):
#
#
# headers = {
# "Content-Type": "application/json"
# }
#
# # convert the data into JSON string
# video_json_str = json.dumps(video)
#
# lecturer_video_resp = requests.post(url='http://127.0.0.1:8000/lecturer/lecturer-video/', data=video_json_str, headers=headers)
#
# response = lecturer_video_resp.json()
#
# return response[0]
# this method will handle the batch processing and video/audio saving pf the system
def
automation_process
(
lecturer
,
subject
,
subject_code
,
video_length
=
"00:20:00"
):
current_date
=
datetime
.
datetime
.
now
()
.
date
()
# this variable will be returned
is_all_processed
=
False
# define the video/audio names to be saved
student_video_name
=
str
(
current_date
)
+
"_{}_student_video.mp4"
.
format
(
subject_code
)
lecturer_video_name
=
str
(
current_date
)
+
"_{}_lecturer_video.mp4"
.
format
(
subject_code
)
lecturer_audio_name
=
str
(
current_date
)
+
"_{}_lecturer_audio.wav"
.
format
(
subject_code
)
# this variable will be passed in the individual batch process
student_video_id
=
0
# create the student video content
student_video_content
=
{
"lecturer"
:
lecturer
,
"subject"
:
subject
,
"date"
:
str
(
current_date
),
"video_name"
:
student_video_name
,
"video_length"
:
video_length
}
# create the student video content
lecturer_video_content
=
{
"lecturer"
:
lecturer
,
"subject"
:
subject
,
"lecturer_date"
:
str
(
current_date
),
"lecture_video_name"
:
lecturer_video_name
,
"lecture_video_length"
:
video_length
}
# create the lecturer audio
lecturer_audio_content
=
{}
# save the student video
student_video_response
=
bp
.
save_student_lecture_video
(
student_video_content
)
# student_video_response = save_student_lecture_video(student_video_content)
student_video_id
=
student_video_response
[
'id'
]
# save the lecturer video
lecturer_video_response
=
lbp
.
save_lecturer_video_details
(
lecturer_video_content
)
# lecturer_video_response = save_lecturer_video_details(lecturer_video_content)
print
(
'lecturer video response: '
,
lecturer_video_response
)
# save the lecturer audio
# start the batch processing for lecture summarization component
# lecture_summary_batch_process = lecture_summarization_batch_process(audio_name)
lecture_summary_batch_process
=
True
# if the lecture summarization process is successful
# if lecture_summary_batch_process:
#
# # start the batch processing for monitoring lecturer performance component
# lecturer_batch_process_response = lecturer_batch_process(lecturer_video_name, lecturer_audio_name)
#
# # if the lecturer performance process is successful
# if lecturer_batch_process_response:
#
# # start the batch processing for monitoring student behavior component
# student_batch_process_response = student_behavior_batch_process(student_video_id, student_video_name)
#
# # if the student behavior process is successful
# if student_batch_process_response:
# is_all_processed = True
# return the status
return
is_all_processed
# test the above method using 'main' method
# if __name__ == '__main__':
#
# lecturer = 1
# subject = 16
# subject_code = "IT1120"
#
# # call the method
# automation_process(lecturer, subject, subject_code)
FirstApp/logic/batch_process.py
View file @
bcdeadae
...
...
@@ -29,10 +29,11 @@ def student_behavior_batch_process(video_id, video_name):
return
is_all_processed
# this method will save the lecture video
# this method will save the
student
lecture video
def
save_student_lecture_video
(
student_video
):
data_dumps
=
json
.
dumps
(
student_video
)
response
=
None
headers
=
{
'Content-Type'
:
'application/json'
...
...
@@ -43,11 +44,12 @@ def save_student_lecture_video(student_video):
student_video_save_resp
=
requests
.
post
(
url
=
'http://127.0.0.1:8000/lecture-video'
,
data
=
data_dumps
,
headers
=
headers
)
data
=
student_video_save_resp
.
json
()
response
=
data
[
0
]
return
data
[
0
]
return
response
if
__name__
==
'__main__'
:
#
if __name__ == '__main__':
# content = {
# "lecturer": 1,
# "subject": 16,
...
...
@@ -63,5 +65,5 @@ if __name__ == '__main__':
#
# save_student_lecture_video(content)
student_behavior_batch_process
(
8
,
"Video_test_8.mp4"
)
#
student_behavior_batch_process(8, "Video_test_8.mp4")
FirstApp/templates/FirstApp/Home.html
View file @
bcdeadae
This diff is collapsed.
Click to expand it.
FirstApp/urls.py
View file @
bcdeadae
...
...
@@ -195,6 +195,9 @@ urlpatterns = [
# perform random task (delete later)
url
(
r'^display-upcoming-lectures/$'
,
api
.
DisplayUpcomingLecturesAPI
.
as_view
()),
# perform random task (delete later)
url
(
r'^automation-process/'
,
api
.
AutomationProcess
.
as_view
()),
...
...
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