Skip to content

mastermind31415926/asr_service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project implements an Automatic Speech Recognition (ASR) service using FastAPI, Faster Whisper model, and MySQL database. It provides endpoints to transcribe audio files and retrieve statistics.

. ├── Dockerfile ├── README.md ├── app │   ├── main.py # FastAPI application entry point, defines API endpoints. │   ├── models.py # Defines database models and configurations. │   ├── stats.py # Functions for handling statistics storage and retrieval. │   └── transcriber.py # Logic for transcribing audio using Faster Whisper. ├── k8s │   ├── app-configmap.yaml # Kubernetes ConfigMap for environment variables. │   ├── app-deployment.yaml # Deployment configuration for FastAPI application. │   ├── app-service.yaml # Service configuration to expose FastAPI. │   ├── app-tests-pod.yaml # Pod definition for running tests. │   ├── mysql-deployment.yaml # Deployment and service for MySQL database. │   └── storage-retain.yaml # Persistent storage class for MySQL. ├── requirements.txt # Python dependencies. └── tests ├── ch1.mp3 # Sample audio file for tests. ├── test_endpoints.py # Functional tests for API endpoints. ├── test_stats.py # Tests statistics functionality. ├── test_transcriber.py # Tests transcription functionality. └── test_unit.py # Unit tests for internal logic.

Setup Instructions for Windows 10 with WSL2

Install Docker

Install Minikube

Install kubectl

Running the Project

Clone the repository:

git clone <repo-url>
cd <project-directory>

Build the Docker image:

make build

Deploy to Minikube:

make deploy

Run tests in Kubernetes (they run authomatically after deployment in a separate test pod):

make test

View test results:

kubectl logs asr-api-tests

Tests Description

Unit Tests

  • Verify internal logic for statistics calculation and database interaction (mocked DB interactions).

Functional Tests

  • Test FastAPI endpoints:
    • /transcribe_audio: Ensures audio transcription works correctly.
    • /stats: Validates retrieval of statistics.
  • Transcription functionality is validated using an audio file (ch1.mp3).

Results are accessible through the test pod logs.

Why MySQL?

MySQL was selected over Redis to ensure data persistence across Minikube restarts or pod deletions.

ASR Service (FastAPI)

  • Exposes two endpoints:

    • /transcribe_audio: Accepts audio and returns transcribed text.
    • /stats: Provides service usage statistics.
  • Service can be tested easily using a graphical web interface via NodePort service.

Access the graphical interface (after deployment):

minikube service asr-api

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors