Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LINAGORA
L
LGS
Labs
linstt-controller
Commits
92329ddb
Commit
92329ddb
authored
Feb 27, 2018
by
Yoann HOUPERT
Browse files
add model id to request
parent
b2225d85
Pipeline
#11511
passed with stage
in 26 minutes and 54 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
lib/controller/offline.js
lib/controller/offline.js
+3
-2
lib/webserver/routes.js
lib/webserver/routes.js
+8
-4
No files found.
lib/controller/offline.js
View file @
92329ddb
...
...
@@ -23,7 +23,7 @@ module.exports = config => {
const
uuidv1
=
require
(
'
uuid/v1
'
);
return
{
transcript
:
(
wavFile
,
enhancementlCallback
)
=>
{
transcript
:
(
wavFile
,
model
,
enhancementlCallback
)
=>
{
let
port
=
config
.
port
;
if
(
process
.
env
.
OFFLINE_PORT
!==
undefined
)
{
port
=
process
.
env
.
OFFLINE_PORT
;
...
...
@@ -45,7 +45,8 @@ module.exports = config => {
filename
:
myUuidString
,
contentType
:
'
audio/x-wav
'
}
}
},
model
},
encoding
:
null
};
...
...
lib/webserver/routes.js
View file @
92329ddb
...
...
@@ -32,11 +32,15 @@ const routesFactory = config => {
const
stt
=
require
(
'
../controller/speech-to-text
'
)(
config
.
gstreamer
);
const
offline
=
require
(
'
../controller/offline
'
)(
config
.
offline
);
routes
.
post
(
'
/api/transcript
'
,
(
req
,
res
)
=>
{
routes
.
post
(
'
/api/transcript
/:model*?
'
,
(
req
,
res
)
=>
{
if
(
!
req
.
body
)
{
return
res
.
status
(
badRequestCode
).
send
(
'
No files were uploaded.
'
);
}
if
(
req
.
params
.
model
===
undefined
)
{
req
.
params
.
model
=
'
uc1
'
;
}
enhancer
.
enhancement
(
req
.
body
,
(
err
,
response
,
body
)
=>
{
if
(
err
)
{
return
res
.
status
(
interalServerCode
).
json
({
module
:
'
Enhancement
'
,
error
:
'
Error during audio enhancing
'
,
info
:
err
.
toString
()});
...
...
@@ -45,7 +49,7 @@ const routesFactory = config => {
}
if
(
process
.
env
.
IS_OFFLINE
===
'
true
'
||
(
process
.
env
.
IS_OFFLINE
===
undefined
&&
config
.
isOffline
===
true
))
{
offline
.
transcript
(
body
,
(
err
,
response
,
body
)
=>
{
offline
.
transcript
(
body
,
req
.
params
.
model
,
(
err
,
response
,
body
)
=>
{
if
(
err
)
{
return
res
.
status
(
interalServerCode
).
json
({
module
:
'
Offline transcription
'
,
error
:
'
Error during audio transcription
'
,
info
:
err
.
toString
()});
}
else
if
(
response
===
undefined
||
body
===
undefined
||
response
.
statusCode
!==
successCode
)
{
...
...
@@ -58,10 +62,10 @@ const routesFactory = config => {
}
const
jsonStr
=
json
.
transcript
.
transcription
;
const
transcription
=
JSON
.
parse
(
json
.
transcript
.
transcription
);
let
jsonResponse
=
{};
try
{
const
transcription
=
JSON
.
parse
(
json
.
transcript
.
transcription
);
jsonResponse
=
{
status
:
0
,
hypotheses
:
transcription
.
hypotheses
,
...
...
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