MetythornPenn / sdab

Khmer Speech to Text Inference with Pretrained Model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sdab

Khmer Automatic Speech Recognition

Sdab is a Python package for Automatic Speech Recognition with focus on Khmer language. It have offline khmer automatic speech recognition model from my Pretrain Model and other that using Wav2Vec2 model.

License: Apache-2.0 License

Pretrain Model: Huggingface

Installation

Install from PyPI

pip install sdab

Install from source

# clone repo 
git clone https://github.com/MetythornPenn/sdab.git

# install lib from source
pip install -e .

Usage

Download sample audio

wget -O audio.wav https://github.com/MetythornPenn/sdab/blob/main/sample/audio.wav

Python API

from sdab import Sdab

file_path = "audio.wav"
model_name = "metythorn/khmer-asr-openslr"  # or local directory path

sdab = Sdab( file_path = file_path, model_name = model_name)
print(sdab.result)

# result : ស្ពានកំពងចំលងអ្នកលើងនៅព្រីវែញជាស្ពានវេញជាងគេសក្នុងព្រសរាជាអាចកម្ពុជា
  • file_path: path of audio file
  • model_name : pretrain model path from huggingface or local
  • device : should be cpu or cuda but I use cpu by default
  • tokenized: show [PAD] in output, False by default
  • return: Khmer text from ASR

Reference

About

Khmer Speech to Text Inference with Pretrained Model

License:Apache License 2.0


Languages

Language:Python 62.8%Language:Jupyter Notebook 37.2%