Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-029
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
2023-029
2023-029
Commits
4562a5f5
Commit
4562a5f5
authored
Sep 02, 2023
by
Sumudu-Himasha-Ranaweera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Backend server
parent
143686f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
32 deletions
+60
-32
Project/Backend/Server_Python/controllers/video_to_sign_language_controller.py
...r_Python/controllers/video_to_sign_language_controller.py
+1
-1
Project/Backend/Server_Python/main.py
Project/Backend/Server_Python/main.py
+2
-0
Project/Frontend/SignConnectPlus/src/pages/video-to-sign-language/VideoTranslate/VideoTranslate.tsx
.../video-to-sign-language/VideoTranslate/VideoTranslate.tsx
+57
-31
Project/Frontend/SignConnectPlus/src/pages/video-to-sign-language/VideoTranslate/Video_trasnlator.tsx.bkp
...-to-sign-language/VideoTranslate/Video_trasnlator.tsx.bkp
+0
-0
No files found.
Project/Backend/Server_Python/controllers/video_to_sign_language_controller.py
View file @
4562a5f5
...
...
@@ -49,7 +49,7 @@ async def uploaded_video(file: UploadFile = File(...)):
translated_text_en
=
translate_text
(
recognized_text
,
"en"
)
translated_integer_si
=
" "
.
join
(
str
(
unicode_to_int_mapping
.
get
(
word
,
0
))
str
(
unicode_to_int_mapping
.
get
(
word
,
"0"
))
for
word
in
translated_text_si
.
split
()
)
print
(
"Translated Integer (Si):"
,
translated_integer_si
)
...
...
Project/Backend/Server_Python/main.py
View file @
4562a5f5
...
...
@@ -41,6 +41,8 @@ app.include_router(video_to_sign_language_controller.router)
origins
=
[
"http://localhost"
,
"http://localhost:8080"
,
"http://127.0.0.1:8000"
,
"http://localhost:3000"
]
app
.
add_middleware
(
...
...
Project/Frontend/SignConnectPlus/src/pages/video-to-sign-language/VideoTranslate/VideoTranslate.tsx
View file @
4562a5f5
// project import
import
MainCard
from
'
components/MainCard
'
;
import
ScrollX
from
'
components/ScrollX
'
;
import
{
Box
,
Button
,
...
...
@@ -19,12 +17,14 @@ import {
TextField
,
Typography
}
from
'
@mui/material
'
;
import
MainCard
from
'
components/MainCard
'
;
import
ScrollX
from
'
components/ScrollX
'
;
import
{
useState
}
from
'
react
'
;
import
{
useSnackbar
}
from
'
notistack
'
;
import
{
CloudUploadOutlined
,
CopyOutlined
,
HighlightOutlined
,
TranslationOutlined
}
from
'
@ant-design/icons
'
;
import
axios
from
'
axios
'
;
import
{
MuiFileInput
}
from
'
mui-file-input
'
;
import
{
CloudUploadOutlined
,
HighlightOutlined
,
CopyOutlined
,
TranslationOutlined
}
from
'
@ant-design/icons
'
;
import
VideoToSignLanguageService
from
'
../../services/VideoToSignLanguage.js
'
;
import
{
useSnackbar
}
from
'
notistack
'
;
import
{
useState
}
from
'
react
'
;
// ==============================|| List ||============================== //
...
...
@@ -56,38 +56,64 @@ const VideoTranslate = () => {
// ----------------- Video Upload ------------------------------------------------
const
TranslateVideoToSignLanguage
=
async
()
=>
{
// const TranslateVideoToSignLanguage = async () => {
// if (file) {
// setLoading(true);
// const formData = new FormData();
// //@ts-ignore
// formData.append('video', file, file.name);
// try {
// const response = await VideoToSignLanguageService.videoTranslation(formData);
// const { translated_text_si, translated_text_en } = response.data;
// setTranslatedTextSi(translated_text_si);
// setTranslatedTextEn(translated_text_en);
// if (response.status == 200) {
// console.log(response.data);
// // setValue(response.data.predictions);
// } else {
// enqueueSnackbar('Something went Wrong!', { variant: 'error' });
// }
// // setLoading(false);
// } catch (error) {
// console.log(error);
// setLoading(false);
// enqueueSnackbar('Something went Wrong!', { variant: 'error' });
// }
// } else {
// enqueueSnackbar('Please select a file.', { variant: 'warning' });
// }
// };
async
function
uploadVideo
()
{
setLoading
(
true
)
if
(
file
)
{
setLoading
(
true
);
const
formData
=
new
FormData
();
//@ts-ignore
formData
.
append
(
'
video
'
,
file
,
file
.
name
);
formData
.
append
(
'
file
'
,
file
);
try
{
const
response
=
await
VideoToSignLanguageService
.
videoTranslation
(
formData
);
const
{
translated_text_si
,
translated_text_en
}
=
response
.
data
;
setTranslatedTextSi
(
translated_text_si
);
setTranslatedTextEn
(
translated_text_en
);
if
(
response
.
status
==
200
)
{
console
.
log
(
response
.
data
);
// setValue(response.data.predictions);
}
else
{
enqueueSnackbar
(
'
Something went Wrong!
'
,
{
variant
:
'
error
'
});
}
// setLoading(false);
const
response
=
await
axios
.
post
(
'
http://127.0.0.1:8000/rest_pyton/uploaded_video
'
,
formData
,
{
headers
:
{
'
Content-Type
'
:
'
multipart/form-data
'
,
},
});
setTranslatedTextEn
(
response
.
data
.
translated_text_en
)
setTranslatedTextSi
(
response
.
data
.
translated_text_si
)
setLoading
(
false
)
}
catch
(
error
)
{
console
.
log
(
error
);
setLoading
(
false
);
enqueueSnackbar
(
'
Something went Wrong!
'
,
{
variant
:
'
error
'
});
console
.
error
(
'
Error:
'
,
error
);
setLoading
(
false
)
}
}
else
{
enqueueSnackbar
(
'
Please select a file.
'
,
{
variant
:
'
warning
'
});
console
.
error
(
'
No file selected.
'
);
setLoading
(
false
)
}
};
}
const
{
enqueueSnackbar
}
=
useSnackbar
();
const
onCopy
=
(
text
:
string
)
=>
{
...
...
@@ -217,7 +243,7 @@ const VideoTranslate = () => {
mb
:
3
}
}
disabled=
{
loading
}
onClick=
{
TranslateVideoToSignLanguage
}
onClick=
{
uploadVideo
}
endIcon=
{
<
TranslationOutlined
/>
}
>
Translate
...
...
Project/Frontend/SignConnectPlus/src/pages/video-to-sign-language/VideoTranslate/Video_trasnlator.tsx
→
Project/Frontend/SignConnectPlus/src/pages/video-to-sign-language/VideoTranslate/Video_trasnlator.tsx
.bkp
View file @
4562a5f5
File moved
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