Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rp_server_one
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
Ranasinghe R.A.P.T
rp_server_one
Commits
7d042348
Commit
7d042348
authored
Aug 03, 2022
by
Ranasinghe R.A.P.T
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'other/model_separation' into 'dev'
Other/model separation See merge request
!6
parents
98243cc2
138eb974
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
23 deletions
+57
-23
resources/__pycache__/speechExtraction.cpython-38.pyc
resources/__pycache__/speechExtraction.cpython-38.pyc
+0
-0
resources/awsOperation.py
resources/awsOperation.py
+4
-4
resources/wordsMappingModel.py
resources/wordsMappingModel.py
+48
-0
resources/wordsProcessModel.py
resources/wordsProcessModel.py
+5
-19
No files found.
resources/__pycache__/speechExtraction.cpython-38.pyc
View file @
7d042348
No preview for this file type
resources/awsOperation.py
View file @
7d042348
...
@@ -4,8 +4,8 @@ import numpy as np
...
@@ -4,8 +4,8 @@ import numpy as np
class
AwsOperation
:
class
AwsOperation
:
def
__init__
(
self
,
bucket_name
):
def
__init__
(
self
):
self
.
bucket_name
=
bucket_name
pass
def
s3_connector
(
self
):
def
s3_connector
(
self
):
...
@@ -13,5 +13,5 @@ class AwsOperation:
...
@@ -13,5 +13,5 @@ class AwsOperation:
aws_access_key_id
=
"AKIAWAP4EPNHCC6BXFXV"
,
aws_access_key_id
=
"AKIAWAP4EPNHCC6BXFXV"
,
aws_secret_access_key
=
"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"
,
aws_secret_access_key
=
"zMj6vrgU8Bc2zcdUALhJ+8RspEbO7mholsZ2mxzZ"
,
)
)
s3
=
session
.
resource
(
's3'
)
return
session
.
resource
(
's3'
)
return
s3
.
Bucket
(
self
.
bucket_name
)
# return s3.Bucket(self.bucket_name)
\ No newline at end of file
\ No newline at end of file
resources/wordsMappingModel.py
0 → 100644
View file @
7d042348
from
.awsOperation
import
AwsOperation
from
moviepy.editor
import
*
from
loguru
import
logger
import
os
import
json
import
cv2
import
numpy
as
np
import
glob
# pamalcodex
class
WordMapping
:
def
__init__
(
self
,
filtered_sentence
):
self
.
filtered_sentence
=
filtered_sentence
def
words_map_with_gestures
(
self
):
try
:
clip_arr
=
[]
aws
=
AwsOperation
()
s3_session
=
aws
.
s3_connector
()
bucket
=
s3_session
.
Bucket
(
'rpserverone'
)
extension
=
".mp4"
for
i
in
range
(
0
,
len
(
self
.
filtered_sentence
)):
print
(
type
(
i
))
print
(
str
(
self
.
filtered_sentence
[
i
])
+
extension
)
bucket
.
download_file
(
str
(
self
.
filtered_sentence
[
i
])
+
extension
,
'D:/s3_tute/'
+
str
(
self
.
filtered_sentence
[
i
])
+
extension
)
for
i
in
range
(
0
,
len
(
self
.
filtered_sentence
)):
with
open
(
'D:/s3_tute/'
+
str
(
self
.
filtered_sentence
[
i
])
+
extension
)
as
f
:
clip
=
VideoFileClip
(
f
.
name
)
clip_arr
.
append
(
clip
)
final
=
concatenate_videoclips
(
clip_arr
)
final
.
write_videofile
(
"assets/final_video/final_out.mp4"
)
s3_session
.
meta
.
client
.
upload_file
(
"assets/final_video/final_out.mp4"
,
"pamalcodex"
,
"final_out.mp4"
)
os
.
remove
(
os
.
path
.
join
(
"D:/rp_server_one/assets/final_video"
,
"final_out.mp4"
))
except
Exception
as
e
:
logger
.
error
(
str
(
e
))
return
json
.
loads
(
json
.
dumps
({
"message"
:
str
(
e
)})),
500
\ No newline at end of file
resources/wordsProcessModel.py
View file @
7d042348
from
nltk.tokenize
import
word_tokenize
from
nltk.tokenize
import
word_tokenize
from
loguru
import
logger
from
loguru
import
logger
from
.awsOperation
import
AwsOperation
from
.awsOperation
import
AwsOperation
from
.wordsMappingModel
import
WordMapping
from
moviepy.editor
import
*
import
os
import
os
import
json
import
json
import
cv2
import
cv2
import
numpy
as
np
import
numpy
as
np
import
glob
import
glob
from
moviepy.editor
import
*
class
WordModel
:
class
WordModel
:
...
@@ -39,24 +41,8 @@ class WordModel:
...
@@ -39,24 +41,8 @@ class WordModel:
if
w
not
in
stop_words
:
if
w
not
in
stop_words
:
filtered_sentence
.
append
(
w
)
filtered_sentence
.
append
(
w
)
aws
=
AwsOperation
(
'rpserverone'
)
word_mapper
=
WordMapping
(
filtered_sentence
)
bucket
=
aws
.
s3_connector
()
word_mapper
.
words_map_with_gestures
()
extension
=
".mp4"
# sign_names = ["this", "beautiful", "day"]
for
i
in
range
(
0
,
len
(
filtered_sentence
)):
print
(
type
(
i
))
print
(
str
(
filtered_sentence
[
i
])
+
extension
)
bucket
.
download_file
(
str
(
filtered_sentence
[
i
])
+
extension
,
'D:/s3_tute/'
+
str
(
filtered_sentence
[
i
])
+
extension
)
for
filename
in
glob
.
glob
(
'D:/s3_tute/*.mp4'
):
clip
=
VideoFileClip
(
filename
)
clip_arr
.
append
(
clip
)
final
=
concatenate_videoclips
(
clip_arr
)
final
.
write_videofile
(
"final_out.mp4"
)
return
json
.
loads
(
json
.
dumps
({
return
json
.
loads
(
json
.
dumps
({
"filtered_words"
:
filtered_sentence
,
"filtered_words"
:
filtered_sentence
,
...
...
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