Skip to content

OnTrack-UG-Squad/speaker-verification-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeQL Python Lint

Speaker Verification Django RESTful API

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.

Table of Contents

Tech stack

Running the project

Prerequisites

Setting up the project

  1. Clone the repository
$ git clone https://github.com/OnTrack-UG-Squad/speaker-verification-api.git
  1. 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
  1. 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
  1. 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)'
  1. Run the Docker containers
$ docker-compose -f docker-compose.yml up -d --build
  1. The app is listening at http://localhost:8000
  • Open http://localhost:8000/redis-healthcheck: Check the Redis's health and the response would be Redis is connected successfully
  • Open http://localhost:8000/flower: Redirects to the Flower dashboard

The runtime output can be viewed via docker logs

API Documentation

API Description

  • 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

Example

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 
  }
}

About

A public repository of work for the Speech Verification RESTful API component of the undergrad squad for Doubtfire.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors