100K+
LinTO-platform-diarization is the LinTO service for speaker diarization.
LinTO-platform-diarization can either be used as a standalone diarization service or deployed as a micro-services.
The transcription service requires docker up and running.
The diarization only entry point in job mode are tasks posted on a Redis message broker. Futhermore, to prevent large audio from transiting through the message broker, diarization uses a shared storage folder mounted on /opt/audio.
linto-platform-diarization can be deployed:
1- First step is to build the image:
git clone https://github.com/linto-ai/linto-platform-diarization.git
cd linto-platform-diarization
docker build . -t linto-platform-diarization:latest
1- Fill the .env
cp .env_default_http .env
Fill the .env with your values.
Parameters:
| Variables | Description | Example |
|---|---|---|
| SERVING_MODE | Specify launch mode | http |
| CONCURRENCY | Number of HTTP worker* | 1+ |
2- Run the container
docker run --rm \
-v SHARED_FOLDER:/opt/audio \
-p HOST_SERVING_PORT:80 \
--env-file .env \
linto-platform-diarization:latest
This will run a container providing an http API binded on the host HOST_SERVING_PORT port.
Parameters:
| Variables | Description | Example |
|---|---|---|
| HOST_SERVING_PORT | Host serving port | 80 |
*diarization uses all CPU available, adding workers will share the available CPU thus decreasing processing speed for concurrent requests
LinTO-platform-diarization can be deployed as a micro-service using celery. Used this way, the container spawn celery worker waiting for diarization task on a message broker.
You need a message broker up and running at SERVICES_BROKER.
1- Fill the .env
cp .env_default_task .env
Fill the .env with your values.
Parameters:
| Variables | Description | Example |
|---|---|---|
| SERVING_MODE | Specify launch mode | task |
| SERVICES_BROKER | Service broker uri | redis://my_redis_broker:6379 |
| BROKER_PASS | Service broker password (Leave empty if there is no password) | my_password |
| QUEUE_NAME | (Optionnal) overide the generated queue's name (See Queue name bellow) | my_queue |
| SERVICE_NAME | Service's name | diarization-ml |
| LANGUAGE | Language code as a BCP-47 code | en-US or * or languages separated by "|" |
| MODEL_INFO | Human readable description of the model | Multilingual diarization model |
| CONCURRENCY | Number of worker (1 worker = 1 cpu) | >1 |
2- Fill the docker-compose.yml
#docker-compose.yml
version: '3.7'
services:
punctuation-service:
image: linto-platform-diarization:latest
volumes:
- /path/to/shared/folder:/opt/audio
env_file: .env
deploy:
replicas: 1
networks:
- your-net
networks:
your-net:
external: true
3- Run with docker compose
docker stack deploy --resolve-image always --compose-file docker-compose.yml your_stack
Queue name:
By default the service queue name is generated using SERVICE_NAME and LANGUAGE: diarization_{LANGUAGE}_{SERVICE_NAME}.
The queue name can be overided using the QUEUE_NAME env variable.
Service discovery:
As a micro-service, the instance will register itself in the service registry for discovery. The service information are stored as a JSON object in redis's db0 under the id service:{HOST_NAME}.
The following information are registered:
{
"service_name": $SERVICE_NAME,
"host_name": $HOST_NAME,
"service_type": "diarization",
"service_language": $LANGUAGE,
"queue_name": $QUEUE_NAME,
"version": "1.2.0", # This repository's version
"info": "Multilingual diarization model",
"last_alive": 65478213,
"concurrency": 1
}
Returns the state of the API
Method: GET
Returns "1" if healthcheck passes.
Diarization API
Return a json object when using structured as followed:
{
"speakers": [
{"spk_id": "spk5", "duration": 2.0, "nbr_seg": 1},
...
],
"segments": [
{"seg_id": 1, "spk_id": "spk5", "seg_begin": 0.0, "seg_end": 2.0},
...
]
}
The /docs route offers a OpenAPI/swagger interface.
STT-Worker accepts requests with the following arguments:
file_path: str, speaker_count: int (None), max_speaker: int (None)
On a successfull transcription the returned object is a json object structured as follow:
{
"speakers": [
{"spk_id": "spk5", "duration": 2.0, "nbr_seg": 1},
...
],
"segments": [
{"seg_id": 1, "spk_id": "spk5", "seg_begin": 0.0, "seg_end": 2.0},
...
]
}
You can test you http API using curl:
curl -X POST "http://YOUR_SERVICE:PORT/diarization" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@YOUR_FILE.wav;type=audio/x-wav" -F "spk_number=NUMBER_OF_SPEAKERS"
This project is developped under the AGPLv3 License (see LICENSE).
Content type
Image
Digest
sha256:209748f94…
Size
2.8 GB
Last updated
about 3 years ago
docker pull lintoai/linto-platform-diarization:simple_diarizer-latestPulls:
514
Last week