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
f55f532c
Commit
f55f532c
authored
Sep 23, 2020
by
LiniEisha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FrontEnd
parent
c69a4c9e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
399 additions
and
74 deletions
+399
-74
LectureSummarizingApp/admin.py
LectureSummarizingApp/admin.py
+1
-0
LectureSummarizingApp/api.py
LectureSummarizingApp/api.py
+16
-13
LectureSummarizingApp/models.py
LectureSummarizingApp/models.py
+2
-1
LectureSummarizingApp/noise.py
LectureSummarizingApp/noise.py
+15
-15
LectureSummarizingApp/serializer.py
LectureSummarizingApp/serializer.py
+8
-4
LectureSummarizingApp/templates/LectureSummarizingApp/summarization.html
...ingApp/templates/LectureSummarizingApp/summarization.html
+331
-37
LectureSummarizingApp/views.py
LectureSummarizingApp/views.py
+26
-4
No files found.
LectureSummarizingApp/admin.py
View file @
f55f532c
...
@@ -6,4 +6,5 @@ from LectureSummarizingApp.models import *
...
@@ -6,4 +6,5 @@ from LectureSummarizingApp.models import *
admin
.
site
.
register
(
LectureAudio
)
admin
.
site
.
register
(
LectureAudio
)
admin
.
site
.
register
(
LectureAudioNoiseRemoved
)
admin
.
site
.
register
(
LectureAudioNoiseRemoved
)
admin
.
site
.
register
(
LectureSpeechToText
)
admin
.
site
.
register
(
LectureSpeechToText
)
admin
.
site
.
register
(
LectureNotices
)
admin
.
site
.
register
(
LectureAudioSummary
)
admin
.
site
.
register
(
LectureAudioSummary
)
LectureSummarizingApp/api.py
View file @
f55f532c
...
@@ -4,7 +4,7 @@ from rest_framework.response import Response
...
@@ -4,7 +4,7 @@ from rest_framework.response import Response
from
LectureSummarizingApp.models
import
LectureAudio
,
LectureAudioNoiseRemoved
,
LectureSpeechToText
,
\
from
LectureSummarizingApp.models
import
LectureAudio
,
LectureAudioNoiseRemoved
,
LectureSpeechToText
,
\
LectureAudioSummary
,
LectureNotices
LectureAudioSummary
,
LectureNotices
from
LectureSummarizingApp.serializer
import
LectureAudioSerializer
,
LectureAudioNoiseRemovedSerializer
,
\
from
LectureSummarizingApp.serializer
import
LectureAudioSerializer
,
LectureAudioNoiseRemovedSerializer
,
\
LectureSpeechToTextSerializer
,
LectureAudioSummarySerializer
LectureSpeechToTextSerializer
,
LectureAudioSummarySerializer
,
LectureNoticesSerializer
# this API will retrieve lecture audio details
# this API will retrieve lecture audio details
...
@@ -66,17 +66,20 @@ class lectureSummaryList(APIView):
...
@@ -66,17 +66,20 @@ class lectureSummaryList(APIView):
)
.
save
()
)
.
save
()
return
Response
({
"response"
:
request
.
data
})
return
Response
({
"response"
:
request
.
data
})
class
lectureNoticeList
(
APIView
):
def
get
(
self
,
request
):
lecture_notice_id
=
LectureNotices
.
objects
.
all
()
serializer
=
LectureSpeechToTextSerializer
(
lecture_notice_id
,
many
=
True
)
return
Response
(
serializer
.
data
)
def
post
(
self
,
request
):
class
lectureNoticeList
(
APIView
):
LectureSpeechToText
(
lecture_notice_id
=
request
.
data
[
"lecture_notice_id"
],
def
get
(
self
,
request
):
lecture_audio_id
=
request
.
data
[
"lecture_audio_id"
],
lecture_notice_id
=
LectureNotices
.
objects
.
all
()
notice_text
=
request
.
data
[
"notice_text"
]
serializer
=
LectureNoticesSerializer
(
lecture_notice_id
,
many
=
True
)
)
.
save
()
return
Response
(
serializer
.
data
)
return
Response
({
"response"
:
request
.
data
})
\ No newline at end of file
def
post
(
self
,
request
):
LectureNotices
(
lecture_notice_id
=
request
.
data
[
"lecture_notice_id"
],
lecture_audio_id
=
request
.
data
[
"lecture_audio_id"
],
notice_text
=
request
.
data
[
"notice_text"
]
)
.
save
()
return
Response
({
"response"
:
request
.
data
})
LectureSummarizingApp/models.py
View file @
f55f532c
...
@@ -19,7 +19,7 @@ class LectureAudio (models.Model):
...
@@ -19,7 +19,7 @@ class LectureAudio (models.Model):
class
LectureAudioNoiseRemoved
(
models
.
Model
):
class
LectureAudioNoiseRemoved
(
models
.
Model
):
lecture_audio_noise_removed_id
=
models
.
CharField
(
max_length
=
10
)
lecture_audio_noise_removed_id
=
models
.
CharField
(
max_length
=
10
)
lecture_audio_id
=
models
.
ForeignKey
(
LectureAudio
,
on_delete
=
models
.
CASCADE
)
lecture_audio_id
=
models
.
ForeignKey
(
LectureAudio
,
on_delete
=
models
.
CASCADE
,
default
=
0
)
lecturer_date
=
models
.
DateField
()
lecturer_date
=
models
.
DateField
()
lecture_audio_name
=
models
.
CharField
(
max_length
=
50
)
lecture_audio_name
=
models
.
CharField
(
max_length
=
50
)
lecture_audio_length
=
models
.
DurationField
()
lecture_audio_length
=
models
.
DurationField
()
...
@@ -46,6 +46,7 @@ class LectureAudioSummary (models.Model):
...
@@ -46,6 +46,7 @@ class LectureAudioSummary (models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
lecture_audio_summary_id
return
self
.
lecture_audio_summary_id
class
LectureNotices
(
models
.
Model
):
class
LectureNotices
(
models
.
Model
):
lecture_notice_id
=
models
.
CharField
(
max_length
=
10
)
lecture_notice_id
=
models
.
CharField
(
max_length
=
10
)
lecture_audio_id
=
models
.
ForeignKey
(
LectureAudio
,
on_delete
=
models
.
CASCADE
)
lecture_audio_id
=
models
.
ForeignKey
(
LectureAudio
,
on_delete
=
models
.
CASCADE
)
...
...
LectureSummarizingApp/noise.py
View file @
f55f532c
...
@@ -19,16 +19,16 @@ def read_file(file_name):
...
@@ -19,16 +19,16 @@ def read_file(file_name):
return
y
,
sr
return
y
,
sr
'''CENTROID'''
#
'''CENTROID'''
#
def
reduce_noise_centroid_s
(
y
,
sr
):
#
def reduce_noise_centroid_s(y, sr):
#
cent
=
librosa
.
feature
.
spectral_centroid
(
y
=
y
,
sr
=
sr
)
#
cent = librosa.feature.spectral_centroid(y=y, sr=sr)
threshold_h
=
np
.
max
(
cent
)
#
threshold_h = np.max(cent)
threshold_l
=
np
.
min
(
cent
)
#
threshold_l = np.min(cent)
less_noise
=
AudioEffectsChain
()
.
lowshelf
(
gain
=-
12.0
,
frequency
=
threshold_l
,
slope
=
0.5
)
.
highshelf
(
gain
=-
12.0
,
frequency
=
threshold_h
,
slope
=
0.5
)
.
limiter
(
gain
=
6.0
)
#
less_noise = AudioEffectsChain().lowshelf(gain=-12.0, frequency=threshold_l, slope=0.5).highshelf(gain=-12.0, frequency=threshold_h, slope=0.5).limiter(gain=6.0)
y_cleaned
=
less_noise
(
y
)
#
y_cleaned = less_noise(y)
return
y_cleaned
#
return y_cleaned
...
@@ -111,19 +111,19 @@ for s in lectures:
...
@@ -111,19 +111,19 @@ for s in lectures:
y
,
sr
=
read_file
(
filename
)
y
,
sr
=
read_file
(
filename
)
y_reduced_centroid_s
=
reduce_noise_centroid_s
(
y
,
sr
)
#
y_reduced_centroid_s = reduce_noise_centroid_s(y, sr)
y_reduced_mfcc_lowshelf
=
mfcc_lowshelf
(
y
,
sr
)
y_reduced_mfcc_lowshelf
=
mfcc_lowshelf
(
y
,
sr
)
y_reduced_mfcc_highshelf
=
mffc_highshelf
(
y
,
sr
)
y_reduced_mfcc_highshelf
=
mffc_highshelf
(
y
,
sr
)
# trimming silences
# trimming silences
y_reduced_centroid_s
,
time_trimmed
=
trim_silence
(
y_reduced_centroid_s
)
#
y_reduced_centroid_s, time_trimmed = trim_silence(y_reduced_centroid_s)
y_reduced_mfcc_up
,
time_trimmed
=
trim_silence
(
mfcc_lowshelf
)
y_reduced_mfcc_up
,
time_trimmed
=
trim_silence
(
mfcc_lowshelf
)
y_reduced_mfcc_down
,
time_trimmed
=
trim_silence
(
mffc_highshelf
)
y_reduced_mfcc_down
,
time_trimmed
=
trim_silence
(
mffc_highshelf
)
output_file
(
'lectures_trimmed_noise_reduced/'
,
filename
,
y_reduced_centroid_s
,
sr
,
'_ctr_s'
)
#
output_file('lectures_trimmed_noise_reduced/' ,filename, y_reduced_centroid_s, sr, '_ctr_s')
output_file
(
'lectures_trimmed_noise_reduced/'
,
filename
,
y_reduced_mfcc_up
,
sr
,
'_mfcc_up'
)
output_file
(
'lectures_trimmed_noise_reduced/'
,
filename
,
y_reduced_mfcc_up
,
sr
,
'_mfcc_up'
)
output_file
(
'lectures_trimmed_noise_reduced/'
,
filename
,
y_reduced_mfcc_down
,
sr
,
'_mfcc_down'
)
#
output_file('lectures_trimmed_noise_reduced/' ,filename, y_reduced_mfcc_down, sr, '_mfcc_down')
output_file
(
'lectures_trimmed_noise_reduced/'
,
filename
,
y
,
sr
,
'_org'
)
#
output_file('lectures_trimmed_noise_reduced/' ,filename, y, sr, '_org')
LectureSummarizingApp/serializer.py
View file @
f55f532c
...
@@ -23,7 +23,8 @@ class LectureAudioNoiseRemovedSerializer(serializers.ModelSerializer):
...
@@ -23,7 +23,8 @@ class LectureAudioNoiseRemovedSerializer(serializers.ModelSerializer):
class
LectureSpeechToTextSerializer
(
serializers
.
ModelSerializer
):
class
LectureSpeechToTextSerializer
(
serializers
.
ModelSerializer
):
lecture_speech_to_text_id
=
LectureAudioNoiseRemovedSerializer
()
# lecture_speech_to_text_id = LectureAudioNoiseRemovedSerializer()
lecture_audio_id
=
LectureAudioSerializer
()
class
Meta
:
class
Meta
:
model
=
LectureSpeechToText
model
=
LectureSpeechToText
...
@@ -31,7 +32,8 @@ class LectureSpeechToTextSerializer(serializers.ModelSerializer):
...
@@ -31,7 +32,8 @@ class LectureSpeechToTextSerializer(serializers.ModelSerializer):
class
LectureAudioSummarySerializer
(
serializers
.
ModelSerializer
):
class
LectureAudioSummarySerializer
(
serializers
.
ModelSerializer
):
lecture_audio_noise_removed_id
=
LectureSpeechToTextSerializer
()
# lecture_audio_noise_removed_id = LectureSpeechToTextSerializer()
lecture_audio_id
=
LectureAudioSerializer
()
class
Meta
:
class
Meta
:
model
=
LectureAudioSummary
model
=
LectureAudioSummary
...
@@ -39,8 +41,10 @@ class LectureAudioSummarySerializer(serializers.ModelSerializer):
...
@@ -39,8 +41,10 @@ class LectureAudioSummarySerializer(serializers.ModelSerializer):
class
LectureNoticesSerializer
(
serializers
.
ModelSerializer
):
class
LectureNoticesSerializer
(
serializers
.
ModelSerializer
):
lecture_audio_noise_removed_id
=
LectureSpeechToTextSerializer
()
# lecture_audio_noise_removed_id = LectureSpeechToTextSerializer()
lecture_audio_id
=
LectureAudioSerializer
()
class
Meta
:
class
Meta
:
model
=
LectureAudioSummary
# model = LectureAudioSummary
model
=
LectureNotices
fields
=
'__all__'
fields
=
'__all__'
\ No newline at end of file
LectureSummarizingApp/templates/LectureSummarizingApp/summarization.html
View file @
f55f532c
{% extends 'FirstApp/template.html' %}
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
>
<html
lang=
"en"
>
<head>
<head>
...
@@ -6,62 +7,355 @@
...
@@ -6,62 +7,355 @@
</head>
</head>
<body>
<body>
<!-- Page Wrapper -->
{% block javascript %}
{% block javascript %}
{% load static %}
{% load static %}
<!-- Bootstrap core JavaScript-->
<!-- Bootstrap core JavaScript-->
<script
src=
"{% static 'FirstApp/vendor/jquery/jquery.min.js' %}"
></script>
<script
src=
"{% static 'FirstApp/vendor/jquery/jquery.min.js' %}"
></script>
<script
src=
"{% static 'FirstApp/vendor/bootstrap/js/bootstrap.bundle.min.js' %}"
></script>
<script
src=
"{% static 'FirstApp/vendor/bootstrap/js/bootstrap.bundle.min.js' %}"
></script>
<!-- Page level plugins -->
<!-- Page level plugins -->
<script
src=
"{% static 'FirstApp/vendor/datatables/jquery.dataTables.min.js' %}"
></script>
<script
src=
"{% static 'FirstApp/vendor/datatables/jquery.dataTables.min.js' %}"
></script>
<script
src=
"{% static 'FirstApp/vendor/datatables/dataTables.bootstrap4.min.js' %}"
></script>
<script
src=
"{% static 'FirstApp/vendor/datatables/dataTables.bootstrap4.min.js' %}"
></script>
<!-- Page level custom scripts -->
<!-- Page level custom scripts -->
<script
src=
"{% static 'FirstApp/js/demo/datatables-demo.js' %}"
></script>
<script
src=
"{% static 'FirstApp/js/demo/datatables-demo.js' %}"
></script>
<!-- Core plugin JavaScript-->
<!-- Core plugin JavaScript-->
<script
src=
"{% static 'FirstApp/vendor/jquery-easing/jquery.easing.min.js' %}"
></script>
<script
src=
"{% static 'FirstApp/vendor/jquery-easing/jquery.easing.min.js' %}"
></script>
<!-- Load TensorFlow.js -->
<script
src=
"https://unpkg.com/@tensorflow/tfjs"
></script>
<!-- Load Posenet -->
<script
src=
"https://unpkg.com/@tensorflow-models/posenet"
>
</script>
{% endblock %}
{% endblock %}
<div
id=
"wrapper"
>
<!-- Sidebar -->
<!-- Content Wrapper --
>
<div
id=
"wrapper"
>
<div
id=
"content-wrapper"
class=
"d-flex flex-column"
>
<div
id=
"content-wrapper"
class=
"d-flex flex-column"
>
<!-- Main Content -->
<div
id=
"content"
>
<div
id=
"content"
>
<!-- Begin Page Content -->
{% block 'container-fluid' %}
{% block 'container-fluid' %}
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
{% load static %}
{% load static %}
<div
class=
"d-sm-flex align-items-center justify-content-between mb-4"
>
<h1
class=
"h3 mb-0 text-gray-800"
>
Lecture Summarization
</h1>
</div>
<!--first row -->
<div
class=
"row p-2"
>
<!--first column -->
<div
class=
"col-lg-6"
style=
"overflow-x: scroll"
>
<div
class=
"card shadow mb-4"
>
<!--card header -->
<div
class=
"card-header py-3"
>
<h5
class=
"m-0 font-weight-bold text-primary"
>
Lecture Recording
</h5>
</div>
<!--card body -->
<div
class=
"card-body"
>
{% if lecture_audio_id.count == 0 %}
<div
class=
"text-center"
>
<span
class=
"font-italic"
>
No Recordings
</span>
</div>
{% else %}
<div
class=
"table-responsive"
>
<table
class=
"table table-bordered"
id=
"datatable"
>
<thead>
<tr>
<th></th>
<th>
Module
</th>
<th>
Date
</th>
<th>
Recording Name
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for lec_audio in lec_audio_data %}
<tr
class=
"recordings not_clicked"
id=
"{{ lec_audio.lecture_audio_id }}"
>
<td>
<div
class=
"radio"
>
<label><input
type=
"radio"
id=
"{{ lec_audio.lecture_audio_id }}"
name=
"recording_radio"
data-name=
"{{ lec_audio.lecture_audio_name }}"
></label>
</div>
</td>
<td>
{{ lec_audio.subject.name }}
</td>
<td>
{{ lec_audio.lecturer_date }}
</td>
<td>
{{ lec_audio.lecture_audio_name }}
</td>
<td>
<button
TYPE=
"button"
class=
"btn btn-success audio_process"
>
Process
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
<!-- Page Heading -->
</div>
<div
class=
"d-sm-flex align-items-center justify-content-between mb-4"
>
<h1
class=
"h3 mb-0 text-gray-800"
>
Lecture Summarization
</h1>
</div>
</div>
<!-- end of 1st column -->
<!-- 2nd column -->
<div
class=
"col-lg-6"
style=
"overflow-x: scroll"
>
<div
class=
"card shadow mb-4"
>
<!--card header -->
<div
class=
"card-header py-3"
>
<h5
class=
"m-0 font-weight-bold text-primary"
>
Lecture Recording (Noise-Removed)
</h5>
</div>
<!--card body -->
<div
class=
"card-body"
>
{% if noiseless_data.count == 0 %}
<div
class=
"text-center"
>
<span
class=
"font-italic"
>
No Recordings
</span>
</div>
{% else %}
<div
class=
"table-responsive"
>
<table
class=
"table table-bordered"
id=
"datatable"
>
<thead>
<tr>
<th></th>
<th>
Module
</th>
<th>
Date
</th>
<th>
Recording Name
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for noiseless_audio in noiseless_data %}
<tr
class=
"recordings not_clicked"
id=
"{{ noiseless_audio.lecture_audio_id }}"
>
<td>
<div
class=
"radio"
>
<label><input
type=
"radio"
id=
"{{ noiseless_audio.lecture_audio_id }}"
name=
"recording_radio"
data-name=
"{{ noiseless_audio.lecture_audio_name }}"
></label>
</div>
</td>
<td>
{{ noiseless_audio.lecture_audio_id.subject.name }}
</td>
<td>
{{ noiseless_audio.lecture_audio_id.lecturer_date }}
</td>
<td>
{{ noiseless_audio.lecture_audio_name }}
</td>
<td>
<button
TYPE=
"button"
class=
"btn btn-success audio_to_text_process"
>
Convert
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
</div>
</div>
<!-- end of 2nd column -->
</div>
<!-- end of 1st row-->
<!--2ND row -->
<div
class=
"row p-2"
>
<!--first row -->
<!--first column -->
<div
class=
"row p-2"
>
<div
class=
"col-lg-6"
style=
"overflow-x: scroll"
>
<div
class=
"card shadow mb-4"
>
<!--card header -->
<div
class=
"card-header py-3"
>
<h5
class=
"m-0 font-weight-bold text-primary"
>
Converted Lecture (Text)
</h5>
</div>
<!--first column -->
<!--card body -->
<div
class=
"col-lg-6"
style=
"overflow-x: scroll"
>
<div
class=
"card-body"
>
<div
class=
"card shadow mb-4"
>
{% if lecture_audio_id.count == 0 %}
<!--card header -->
<div
class=
"text-center"
>
<div
class=
"card-header py-3"
>
<span
class=
"font-italic"
>
No Recordings
</span>
<h5
class=
"m-0 font-weight-bold text-primary"
>
Remove Background noise
</h5>
</div>
</div>
<!--card body -->
{% else %}
<div
class=
"card-body"
>
<div
class=
"table-responsive"
>
{% if lecturer_subjects.count == 0 %}
<table
class=
"table table-bordered"
id=
"datatable"
>
<div
class=
"text-center"
>
<thead>
<span
class=
"font-italic"
>
No subjects
</span>
<tr>
</div>
<th></th>
<th>
Module
</th>
<th>
Date
</th>
<th>
Text ID
</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% for lec_text in lecture_text_data %}
<tr
class=
"recordings not_clicked"
id=
"{{ lec_text.lecture_audio_id }}"
>
<td>
<div
class=
"radio"
>
<label><input
type=
"radio"
id=
"{{ lec_text.lecture_audio_id }}"
name=
"recording_radio"
data-name=
"{{ lec_text.lecture_audio_name }}"
></label>
</div>
</td>
<td>
{{ lec_text.lecture_audio_id.subject.name }}
</td>
<td>
{{ lec_text.lecture_audio_id.lecturer_date }}
</td>
<td>
{{ lec_text.lecture_speech_to_text_id }}
</td>
<td>
<button
TYPE=
"button"
class=
"btn btn-success to_summary"
>
Summary
</button>
</td>
<td>
<button
TYPE=
"button"
class=
"btn btn-success get_notices"
>
Notices
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
</div>
</div>
<!-- end of 1st column -->
</div>
<!-- end of 2nd row-->
<!--3rd row -->
<div
class=
"row p-2"
>
<!--first column -->
<div
class=
"col-lg-6"
style=
"overflow-x: scroll"
>
<div
class=
"card shadow mb-4"
>
<!--card header -->
<div
class=
"card-header py-3"
>
<h5
class=
"m-0 font-weight-bold text-primary"
>
Lecture Summary
</h5>
</div>
<!--card body -->
<div
class=
"card-body"
>
{% if lecture_audio_summary_id.count == 0 %}
<div
class=
"text-center"
>
<span
class=
"font-italic"
>
No Summaries
</span>
</div>
{% else %}
<div
class=
"table-responsive"
>
<table
class=
"table table-bordered"
id=
"datatable"
>
<thead>
<tr>
<th></th>
<th>
Module
</th>
<th>
Date
</th>
<th>
Summary
</th>
</tr>
</thead>
<tbody>
{% for lec_summary in lec_summary_data %}
<tr
class=
"recordings not_clicked"
id=
"{{ lec_summary.lecture_audio_id }}"
>
<td>
<div
class=
"radio"
>
<label><input
type=
"radio"
id=
"{{ lec_summary.lecture_audio_id }}"
name=
"recording_radio"
data-name=
"{{ lec_summary.lecture_audio_name }}"
></label>
</div>
</td>
<td>
{{ lec_summary.lecture_audio_id.subject.name }}
</td>
<td>
{{ lec_summary.lecture_audio_id.lecturer_date }}
</td>
<td>
{{ lec_summary.lecture_audio_summary_id }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
</div>
</div>
<!-- end of 1st column -->
<!-- 2nd column -->
<div
class=
"col-lg-6"
style=
"overflow-x: scroll"
>
<div
class=
"card shadow mb-4"
>
<!--card header -->
<div
class=
"card-header py-3"
>
<h5
class=
"m-0 font-weight-bold text-primary"
>
Lecture Notices
</h5>
</div>
<!--card body -->
<div
class=
"card-body"
>
{% if noiseless_data.count == 0 %}
<div
class=
"text-center"
>
<span
class=
"font-italic"
>
No Recordings
</span>
</div>
{% else %}
<div
class=
"table-responsive"
>
<table
class=
"table table-bordered"
id=
"datatable"
>
<thead>
<tr>
<th></th>
<th>
Module
</th>
<th>
Date
</th>
<th>
Notices
</th>
</tr>
</thead>
<tbody>
{% for lec_notice in lec_notice_data %}
<tr
class=
"recordings not_clicked"
id=
"{{ lec_notice.lecture_audio_id }}"
>
<td>
<div
class=
"radio"
>
<label><input
type=
"radio"
id=
"{{ lec_notice.lecture_audio_id }}"
name=
"recording_radio"
data-name=
"{{ noiseless_audio.lecture_audio_name }}"
></label>
</div>
</td>
<td>
{{ lec_notice.lecture_audio_id.subject.name }}
</td>
<td>
{{ lec_notice.lecture_audio_id.lecturer_date }}
</td>
<td>
{{ lec_notice.lecture_notice_id }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
</div>
</div>
<!-- end of 2nd column -->
{% endblock %}
</div>
</div>
</div>
</body>
</body>
</html>
</html>
\ No newline at end of file
LectureSummarizingApp/views.py
View file @
f55f532c
...
@@ -6,13 +6,35 @@ from rest_framework.response import Response
...
@@ -6,13 +6,35 @@ from rest_framework.response import Response
from
rest_framework
import
viewsets
from
rest_framework
import
viewsets
from
.models
import
LectureAudio
,
LectureAudioNoiseRemoved
,
LectureSpeechToText
,
LectureAudioSummary
,
LectureNotices
from
.models
import
LectureAudio
,
LectureAudioNoiseRemoved
,
LectureSpeechToText
,
LectureAudioSummary
,
LectureNotices
from
.serializer
import
LectureAudioSerializer
,
LectureAudioNoiseRemovedSerializer
,
LectureAudioSummarySerializer
,
\
from
.serializer
import
LectureAudioSerializer
,
LectureAudioNoiseRemovedSerializer
,
LectureAudioSummarySerializer
,
\
LectureSpeechToTextSerializer
LectureSpeechToTextSerializer
,
LectureNoticesSerializer
# Create your views here.
# Create your views here.
def
summarization
(
request
):
def
summarization
(
request
):
return
render
(
request
,
"LectureSummarizingApp/summarization.html"
)
lec_audio
=
LectureAudio
.
objects
.
all
()
lec_audio_serializer
=
LectureAudioSerializer
(
lec_audio
,
many
=
True
)
data
=
lec_audio_serializer
.
data
lec_noiseless_audio
=
LectureAudioNoiseRemoved
.
objects
.
all
()
lec_noiseless_audio_ser
=
LectureAudioNoiseRemovedSerializer
(
lec_noiseless_audio
,
many
=
True
)
noiseless_data
=
lec_noiseless_audio_ser
.
data
lec_text
=
LectureSpeechToText
.
objects
.
all
()
lec_text_ser
=
LectureSpeechToTextSerializer
(
lec_text
,
many
=
True
)
lecture_text_data
=
lec_text_ser
.
data
lec_summary
=
LectureAudioSummary
.
objects
.
all
()
lec_summary_ser
=
LectureAudioSummarySerializer
(
lec_summary
,
many
=
True
)
lec_summary_data
=
lec_summary_ser
.
data
lec_notice
=
LectureNotices
.
objects
.
all
()
lec_notice_ser
=
LectureNoticesSerializer
(
lec_notice
,
many
=
True
)
lec_notice_data
=
lec_notice_ser
.
data
return
render
(
request
,
"LectureSummarizingApp/summarization.html"
,
{
"lec_audio_data"
:
data
,
"noiseless_data"
:
noiseless_data
,
"lecture_text_data"
:
lecture_text_data
,
"lec_summary_data"
:
lec_summary_data
,
"lec_notice_data"
:
lec_notice_data
})
class
audioList
(
APIView
):
class
audioList
(
APIView
):
...
@@ -79,11 +101,11 @@ class lectureSummaryList(APIView):
...
@@ -79,11 +101,11 @@ class lectureSummaryList(APIView):
def
get
(
self
,
request
):
def
get
(
self
,
request
):
lecture_notice_id
=
LectureNotices
.
objects
.
all
()
lecture_notice_id
=
LectureNotices
.
objects
.
all
()
serializer
=
Lecture
SpeechToText
Serializer
(
lecture_notice_id
,
many
=
True
)
serializer
=
Lecture
Notices
Serializer
(
lecture_notice_id
,
many
=
True
)
return
Response
(
serializer
.
data
)
return
Response
(
serializer
.
data
)
def
post
(
self
,
request
):
def
post
(
self
,
request
):
Lecture
SpeechToText
(
Lecture
Notices
(
lecture_notice_id
=
request
.
data
[
"lecture_notice_id"
],
lecture_notice_id
=
request
.
data
[
"lecture_notice_id"
],
lecture_audio_id
=
request
.
data
[
"lecture_audio_id"
],
lecture_audio_id
=
request
.
data
[
"lecture_audio_id"
],
notice_text
=
request
.
data
[
"notice_text"
]
notice_text
=
request
.
data
[
"notice_text"
]
...
...
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