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
325d7379
Commit
325d7379
authored
Jan 10, 2021
by
LiniEisha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate
parent
676918b1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
4 deletions
+67
-4
LectureSummarizingApp/api.py
LectureSummarizingApp/api.py
+3
-2
LectureSummarizingApp/lecture_audio_batch_process.py
LectureSummarizingApp/lecture_audio_batch_process.py
+62
-0
LectureSummarizingApp/urls.py
LectureSummarizingApp/urls.py
+1
-1
LectureSummarizingApp/voice_recorder.py
LectureSummarizingApp/voice_recorder.py
+1
-1
No files found.
LectureSummarizingApp/api.py
View file @
325d7379
...
...
@@ -18,16 +18,17 @@ from .ExtractKeySentences import GetLectureNotice
from
.Summary
import
LectureSummary
from
.noise
import
noise_removal
from
.speech_to_text
import
speech_to_text
from
.voice_recorder
import
AudioRecorder
class
LectureAudioAPI
(
APIView
):
def
ge
t
(
self
,
request
):
def
pos
t
(
self
,
request
):
lecture_audio
=
LectureAudio
.
objects
.
all
()
.
order_by
(
'lecturer_date'
)
lecture_audio_serializer
=
LectureAudioSerializer
(
lecture_audio
,
many
=
True
)
audio_list
=
LectureAudio
.
objects
.
order_by
(
'lecture_audio_id'
)
.
last
()
audio_name
=
request
.
query_params
.
get
(
"audio_name"
)
audio_name
=
request
.
data
[
'audio_name'
]
# id = int(request.query_params.get("id"))
new_audio_id
=
generate_new_id
(
audio_list
.
lecture_audio_noise_removed_id
)
...
...
LectureSummarizingApp/lecture_audio_batch_process.py
0 → 100644
View file @
325d7379
import
json
import
requests
# this method calls all the summarization methods in one place
def
summarization_batch_process
(
audio_id
,
audio_name
):
is_all_processed
=
False
noise_removed_resp
=
requests
.
get
(
'http://127.0.0.1:800/summary/lecture-audio-noise-removed'
,
params
=
{
'id'
:
audio_id
,
'audio_name'
:
audio_name
})
if
noise_removed_resp
.
json
()[
'response'
]
==
200
:
audio_root_name
=
audio_name
.
split
(
'.'
)[
0
]
speech_to_text_name
=
audio_root_name
+
'.txt'
audio_text_resp
=
requests
.
get
(
'http://127.0.0.1:800/summary/lecture-audio-to-text'
,
params
=
{
'id'
:
audio_id
,
'speech_to_text_name'
:
speech_to_text_name
})
if
audio_text_resp
.
json
()[
'response'
]
==
200
:
summary_name
=
audio_name
+
'.txt'
summary_resp
=
requests
.
get
(
'http://127.0.0.1:800/summary/lecture-summary'
,
params
=
{
'id'
:
audio_id
,
'lecture_summary_name'
:
summary_name
})
if
summary_resp
.
json
()[
'response'
]
==
200
:
notice_resp
=
requests
.
get
(
'http://127.0.0.1:800/summary/lecture-notices'
,
params
=
{
'id'
:
audio_id
,
'lecture_notice_name'
:
summary_name
})
if
notice_resp
.
json
()[
'response'
]
==
200
:
is_all_processed
=
True
return
is_all_processed
def
save_lecturer_audio
(
lecturer_audio
):
data_dumps
=
json
.
dumps
(
lecturer_audio
)
response
=
None
headers
=
{
'Content-Type'
:
'application/json'
}
# call the API
# student_video_save_resp = requests.post('http://127.0.0.1:8000/lecture-video', student_video)
lecturer_audio_save_resp
=
requests
.
post
(
url
=
'http://127.0.0.1:8000/summary/lecture-audio'
,
data
=
data_dumps
,
headers
=
headers
)
data
=
lecturer_audio_save_resp
.
json
()
response
=
data
[
0
]
return
response
# this is a test method (delete later)
if
__name__
==
'__main__'
:
audio_id
=
1
audio_name
=
'Lecture01.wav'
summarization_batch_process
(
audio_id
=
audio_id
,
audio_name
=
audio_name
)
\ No newline at end of file
LectureSummarizingApp/urls.py
View file @
325d7379
...
...
@@ -12,7 +12,7 @@ urlpatterns = [
# API to retrieve lecture summarizing details
url
(
r'^lecture-audio
/$
'
,
api
.
LectureAudioAPI
.
as_view
()),
url
(
r'^lecture-audio'
,
api
.
LectureAudioAPI
.
as_view
()),
url
(
r'^lecture-audio-noise-removed/$'
,
api
.
audioNoiseRemovedList
.
as_view
()),
...
...
LectureSummarizingApp/
Voice R
ecorder.py
→
LectureSummarizingApp/
voice_r
ecorder.py
View file @
325d7379
...
...
@@ -12,7 +12,7 @@ def AudioRecorder(audio):
DESTINATION_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"audioArray
\\
{}"
.
format
(
audio
))
#for the audio
LECTURE_AUDIO_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"lectures
\\
Lecture_
{}"
.
format
(
audio
))
LECTURE_AUDIO_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"lectures
\\
{}"
.
format
(
audio
))
# Sampling frequency
...
...
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