As Speaker Verification, a Python package, matures, the direction of its finial implementation needs to be considered. This project tends to be a continually evolving extension of Doubtfire. This direction, Speaker Verification API Based on Django, will serve as an effective way to guide next steps on how the project will proceed.
- Clone the repository
$ git clone https://github.com/OnTrack-UG-Squad/speaker-verification-api.git
- Copy .env.dev.db.sample & .env.dev.sample files from sample_envs to project root. Remove .sample at the end of the file extensions.
$ cp sample_envs/.env.dev.db.sample .env.dev.db
$ cp sample_envs/.env.dev.sample .env.dev
- Fill the env files
- Populate
POSTGRES_USER
,POSTGRES_PASSWORD
,POSTGRES_DB
in.env.dev.db
(Choose any user name and password) - Copy these values to the corresponding fields in .env.dev:
SQL_USER=POSTGRES_USER
,SQL_DATABASE=POSTGRES_DB
SQL_PASSWORD=POSTGRES_PASSWORD
- Populate
SECRET_KEY
in.env.dev
- Generate a key with the following Python command
$ python3 -c 'import random; result = "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-*=+)") for i in range(50)]); print(result)'
- Run the Docker containers
$ docker-compose -f docker-compose.yml up -d --build
- The app is listening at
http://localhost:8000
- Open
http://localhost:8000/redis-healthcheck
: Check theRedis
's health and the response would beRedis is connected successfully
- Open
http://localhost:8000/flower
: Redirects to theFlower
dashboard
The runtime output can be viewed via docker logs
- Enrolling a user
POST /enroll
Request POST
Parameter | Type | Description |
---|---|---|
id | number | User ID |
recording_link | string | User's recording link |
Response
Field | Type | Description |
---|---|---|
success | boolean | The result of enrolment's processing |
- Validating a recording
POST /validate
Request POST
Parameter | Type | Description |
---|---|---|
id | number | User ID |
recording_link | string | User's recording link |
Response
Field | Type | Description |
---|---|---|
success | boolean | The result of enrolment's processing |
data | object | The value contains the accuracy score |
Enrolling a user
Send POST request to http://localhost:8000/enroll with the content:
{
"id": 123456789,
"recording_link": "https://speaker-ver-api-td.s3-ap-southeast-2.amazonaws.com/enrollment.flac"
}
If this has been successful you should see in the response:
{
"success": true
}
Validating a recording
Send a POST request to http://localhost:8000/validate with the content:
{
"id": 123456789,
"recording_link": "https://speaker-ver-api-td.s3-ap-southeast-2.amazonaws.com/validation.flac"
}
If this has been successful you should see in the response:
{
"success": true,
"data": {
"score": 83.34
}
}