Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-191
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-191
2023-191
Commits
5fe77a19
Commit
5fe77a19
authored
Aug 20, 2023
by
Shashika Idushan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'Idushan-K.A.S-DEV'
Master See merge request
!3
parents
948a40fe
bd2dcd81
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
869 additions
and
60 deletions
+869
-60
Backend/Audio to Sign Converter.ipynb
Backend/Audio to Sign Converter.ipynb
+775
-0
Frontend/src/App.js
Frontend/src/App.js
+0
-2
Frontend/src/components/SideNavBar.jsx
Frontend/src/components/SideNavBar.jsx
+1
-1
Frontend/src/pages/AudioToSign.jsx
Frontend/src/pages/AudioToSign.jsx
+25
-10
Frontend/src/styles/audioToSign.css
Frontend/src/styles/audioToSign.css
+0
-47
SpringBootBackend/src/main/java/shrasthra/backend/controller/ShrasthraBackendController.java
...asthra/backend/controller/ShrasthraBackendController.java
+7
-0
SpringBootBackend/src/main/java/shrasthra/backend/service/i/ShrasthraBackendService.java
.../shrasthra/backend/service/i/ShrasthraBackendService.java
+2
-0
SpringBootBackend/src/main/java/shrasthra/backend/service/impl/ShrasthraBackendServiceImpl.java
...hra/backend/service/impl/ShrasthraBackendServiceImpl.java
+57
-0
SpringBootBackend/src/main/java/shrasthra/backend/util/common/REST_CONTROLLER_URL.java
...va/shrasthra/backend/util/common/REST_CONTROLLER_URL.java
+2
-0
No files found.
Backend/Audio to Sign Converter.ipynb
0 → 100644
View file @
5fe77a19
This diff is collapsed.
Click to expand it.
Frontend/src/App.js
View file @
5fe77a19
...
...
@@ -11,7 +11,6 @@ import Login from './pages/Login';
import
Register
from
'
./pages/Register
'
;
import
{
useEffect
,
useState
}
from
'
react
'
;
import
Test
from
'
./pages/Test
'
;
import
AudioToSign
from
'
./pages/AudioToSign
'
;
function
App
()
{
const
[
isLogged
,
setIsLogged
]
=
useState
(
sessionStorage
.
getItem
(
"
isLogged
"
));
...
...
@@ -31,7 +30,6 @@ function App() {
<
Routes
>
{
/* <Route path='*' element={<VideoToSign/>}/> */
}
<
Route
exact
path
=
'
/sign-detection
'
element
=
{
<
VideoToSign
/>
}
/
>
<
Route
exact
path
=
'
/audio-to-sign
'
element
=
{
<
AudioToSign
/>
}
/
>
<
/Routes>
<
/div
>
...
...
Frontend/src/components/SideNavBar.jsx
View file @
5fe77a19
...
...
@@ -31,7 +31,7 @@ function SideNavBar() {
{
/* සංඥා ශබ්දකෝෂය */
}
<
NavLink
exact
to=
"/about"
className=
"nav-link main-nav-link"
activeClassName=
"active-link"
>
ix
{
d YíofldaIh
</
NavLink
>
{
/* ශබ්ද පරිවර්ථකය */
}
<
NavLink
exact
to=
"/
audio-to-sign
"
className=
"nav-link main-nav-link"
activeClassName=
"active-link"
>
Yío mßj¾:lh
</
NavLink
>
<
NavLink
exact
to=
"/
contact
"
className=
"nav-link main-nav-link"
activeClassName=
"active-link"
>
Yío mßj¾:lh
</
NavLink
>
{
/* සංඥා හඳුනාගැනීම */
}
<
NavLink
exact
to=
"/sign-detection"
className=
"nav-link main-nav-link "
activeClassName=
"active-link"
>
ix
{
d y÷kd.ekSu
</
NavLink
>
{
/* වාචික පුහුණුව */
}
...
...
Frontend/src/pages/AudioToSign.jsx
View file @
5fe77a19
...
...
@@ -7,6 +7,12 @@ import '../styles/audioToSign.css';
const
AudioToSign
=
()
=>
{
const
[
isLogged
,
setIsLogged
]
=
useState
(
sessionStorage
.
getItem
(
"
isLogged
"
));
const
[
token
,
setToken
]
=
useState
(
sessionStorage
.
getItem
(
"
token
"
));
const
[
username
,
setUserName
]
=
useState
(
sessionStorage
.
getItem
(
"
username
"
));
const
[
userId
,
setUserId
]
=
useState
(
sessionStorage
.
getItem
(
"
userId
"
));
const
[
file
,
setFile
]
=
useState
(
null
);
const
handleFileChange
=
(
event
)
=>
{
...
...
@@ -80,17 +86,26 @@ const AudioToSign = () => {
const
handleAudioUpload
=
()
=>
{
console
.
log
(
audioFile
)
const
formData
=
new
FormData
();
formData
.
append
(
'
audio1
'
,
audioFile
);
axios
.
post
(
'
http://127.0.0.1:5000/transcribe-audio
'
,
formData
)
.
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
'
Audio uploaded successfully
'
);
const
fileData
=
new
FormData
();
// formData.append('audio1', audioFile);
fileData
.
append
(
'
file
'
,
audioFile
);
RestService
.
audioToSing
(
token
,
fileData
).
then
((
res
)
=>
{
// setMeaning(res.data.signMap.value);
console
.
log
(
res
);
}).
catch
((
err
)
=>
{
console
.
log
(
err
);
})
.
catch
(
error
=>
{
console
.
error
(
'
Error:
'
,
error
);
});
// axios.post('http://127.0.0.1:5000/transcribe-audio', formData)
// .then(response => {
// console.log(response);
// console.log('Audio uploaded successfully');
// })
// .catch(error => {
// console.error('Error:', error);
// });
};
...
...
Frontend/src/styles/audioToSign.css
deleted
100644 → 0
View file @
948a40fe
.video-box1
{
border-width
:
3px
;
border-color
:
#af2c00
;
border-style
:
solid
;
border-radius
:
2vw
;
box-shadow
:
0
4px
8px
0
rgba
(
0
,
0
,
0
,
0.552
),
0
10px
10px
0
rgba
(
0
,
0
,
0
,
0.338
);
/* box-shadow: 0 1px 10px 0 rgba(66, 66, 66, 0.336), 0 6px 20px 0 rgba(100, 100, 100, 0.082); */
/* width: 40vw; */
height
:
45vh
;
width
:
65vh
;
align-items
:
center
;
background-color
:
black
;
background-image
:
url('../images/Skulls.jpg')
;
}
.aa
{
align-items
:
end
;
}
.card
{
align-items
:
end
;
width
:
100%
;
background-color
:
transparent
;
border-color
:
transparent
;
}
section
{
margin
:
20px
;
}
input
::-webkit-file-upload-button
{
position
:
absolute
;
padding
:
6px
15px
;
background-color
:
rgb
(
230
,
154
,
78
);
border
:
none
;
border-radius
:
5px
;
color
:
white
;
text-transform
:
uppercase
;
box-shadow
:
0px
3px
3px
-2px
rgba
(
0
,
0
,
0
,
0.2
),
0px
3px
4px
0px
rgba
(
0
,
0
,
0
,
0.14
),
0px
1px
8px
0px
rgba
(
0
,
0
,
0
,
0.12
);
transition
:
100ms
ease-out
;
cursor
:
pointer
;
}
input
::-webkit-file-upload-button:hover
{
background-color
:
#9e8160
;
box-shadow
:
0px
3px
5px
-1px
rgba
(
0
,
0
,
0
,
0.2
),
0px
5px
8px
0px
rgba
(
0
,
0
,
0
,
0.14
),
0px
1px
14px
0px
rgba
(
0
,
0
,
0
,
0.12
)
}
\ No newline at end of file
SpringBootBackend/src/main/java/shrasthra/backend/controller/ShrasthraBackendController.java
View file @
5fe77a19
...
...
@@ -45,6 +45,13 @@ public class ShrasthraBackendController {
return
responseDto
;
}
@RequestMapping
(
value
=
REST_CONTROLLER_URL
.
AUDIO_TO_SIGN
,
method
=
RequestMethod
.
POST
)
public
@ResponseBody
ProcessResponseDto
audioToSign
(
@RequestParam
(
"file"
)
MultipartFile
file
,
HttpServletRequest
request
){
ProcessResponseDto
responseDto
=
new
ProcessResponseDto
();
responseDto
=
backendService
.
audioToSign
(
file
);
return
responseDto
;
}
...
...
SpringBootBackend/src/main/java/shrasthra/backend/service/i/ShrasthraBackendService.java
View file @
5fe77a19
...
...
@@ -8,5 +8,7 @@ import shrasthra.backend.dao.dto.ProcessResponseDto;
public
interface
ShrasthraBackendService
{
public
ProcessResponseDto
detectDynamicSign
(
MultipartFile
file
);
public
ProcessResponseDto
audioToSign
(
MultipartFile
file
);
}
SpringBootBackend/src/main/java/shrasthra/backend/service/impl/ShrasthraBackendServiceImpl.java
View file @
5fe77a19
...
...
@@ -101,4 +101,61 @@ public class ShrasthraBackendServiceImpl implements ShrasthraBackendService{
return
responseDto
;
}
public
ProcessResponseDto
audioToSign
(
MultipartFile
file
)
{
ProcessResponseDto
responseDto
=
new
ProcessResponseDto
();
try
{
if
(!
file
.
isEmpty
())
{
// Convert the file to bytes
byte
[]
fileBytes
=
file
.
getBytes
();
RestTemplate
restTemplate
=
new
RestTemplate
();
// Set the URL of your Python Flask API
String
url
=
"http://127.0.0.1:5000/transcribe-audio"
;
// Create headers and set content type as multipart/form-data
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
MULTIPART_FORM_DATA
);
// Create the request body with the file as a part
MultiValueMap
<
String
,
Object
>
requestBody
=
new
LinkedMultiValueMap
<>();
requestBody
.
add
(
"fileData"
,
new
ByteArrayResource
(
fileBytes
)
{
@Override
public
String
getFilename
()
{
return
file
.
getOriginalFilename
();
}
});
// Create the request entity with headers and body
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
requestEntity
=
new
HttpEntity
<>(
requestBody
,
headers
);
// Make the POST request to the second API
ResponseEntity
<
ProcessResponseDto
>
response
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
POST
,
requestEntity
,
ProcessResponseDto
.
class
);
// Retrieve the response body
ProcessResponseDto
responseBody
=
response
.
getBody
();
// Print the response
if
(
responseBody
.
getSign
()
!=
null
)
{
SignMap
signMap
=
signMapRepository
.
findSignMapByLabel
(
responseBody
.
getSign
());
if
(
signMap
!=
null
)
{
responseDto
.
setSignMap
(
signMap
);
responseDto
.
setSuccess
(
true
);
}
}
}
}
catch
(
Exception
e
)
{
responseDto
.
setSuccess
(
false
);
System
.
out
.
println
(
"detectDynamicSign : "
+
e
);
}
return
responseDto
;
}
}
SpringBootBackend/src/main/java/shrasthra/backend/util/common/REST_CONTROLLER_URL.java
View file @
5fe77a19
...
...
@@ -7,4 +7,6 @@ public class REST_CONTROLLER_URL {
public
static
final
String
DETECT_DYNAMIC_SIGN
=
"/sign/detectDynamicSign"
;
public
static
final
String
AUDIO_TO_SIGN
=
"/sign/audioToSign"
;
}
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