Commit 020b27bc authored by Yoann HOUPERT's avatar Yoann HOUPERT
Browse files

init structure

parent f3dbc9e6
......@@ -25,7 +25,7 @@ const routes = require('./lib/webserver/routes');
console.log('starting routes linstt-poc-socgen...');
app.use('/', routes.routesFactory());
app.use('/', routes.routesFactory(config.orchestrator));
app.listen(config.api, () => {
console.log('App listening on port 3000');
});
......
linstt-poc-socgen Documentation
You will find in this folder all the required information to configure, use, develop the linstt-poc-socgen project.
# POST /api/transcript
Create a transcript text from an audio file
**Request Headers:**
- Accept: application/json
**Request Body**
This endpoint expects the request body to be a wav file
- Rate 16KHz
- Canal 1
- Binary 16
- Encoding little endian
**Status Codes:**
- 200 Ok
- 500 Internal server error
**Response Headers:**
- Content-Type: application/json
**Response JSON Object:**
- text: contain the transcription (only on succes)
- status: contain the state of the answser (only on error)
- err: contain the error description (only on error)
**Request:**
POST /api/transcript
Accept: application/json
Host: localhost:8080
A wav File
**Response:**
HTTP/1.1 200 Ok
{
text : 'here the transcript'
}
HTTP/1.1 500 Ok
{
status : X , err : 'here the error'
}
/*
* Copyright (c) 2017 Linagora.
*
* This file is part of linstt-poc-socgen
* (see https://ci.linagora.com/linagora/lgs/labs/linstt-poc-socgen).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const enhancement = audio => {
console.log('transcript of the audio');
console.log('Do stuff' + audio);
return 'some text';
};
module.exports = {
enhancement
};
/*
* Copyright (c) 2017 Linagora.
*
* This file is part of linstt-poc-socgen
* (see https://ci.linagora.com/linagora/lgs/labs/linstt-poc-socgen).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const transcript = audio => {
const enhancedAudio = audio;
console.log('Enhancement of the audio');
return enhancedAudio;
};
module.exports = {
transcript
};
......@@ -17,12 +17,21 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const routesFactory = () => {
const routesFactory = config => {
/* eslint new-cap: ["error", { "capIsNew": false }] */
const routes = require('express').Router();
const enhancer = require('../speech-enhancement');
const stt = require('../speech-to-text');
routes.post('/api/transcript', (req, res) => {
console.log('first routes');
console.log(config);
// TODO manage first call to config.speechEnhancementURL
enhancer.enhancement();
// TODO manage first call to config.gstreamerURL
stt.transcript();
res.status(200).json({message: 'transcript call'});
});
return routes;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment