OnTrack-UG-Squad / speaker-verification-api

A public repository of work for the Speech Verification RESTful API component of the undergrad squad for Doubtfire.
MIT License
2 stars 5 forks source link

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
  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)'
  2. Run the Docker containers

$ docker-compose -f docker-compose.yml up -d --build
  1. The app is listening at http://localhost:8000

The runtime output can be viewed via docker logs

API Documentation

API Description

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