PyThaiNLP / pythaiasr

Python Thai Automatic Speech Recognition
Apache License 2.0
62 stars 13 forks source link
asr automatic-speech-recognition hacktoberfest hacktoberfest2022 thai-language thai-nlp

PyThaiASR

Python Thai Automatic Speech Recognition

pypiLicenseDownloadCoverage Status

PyThaiASR is a Python package for Automatic Speech Recognition with focus on Thai language. It have offline thai automatic speech recognition model.

License: Apache-2.0 License

Google Colab: Link Google colab

Model homepage: https://huggingface.co/airesearch/wav2vec2-large-xlsr-53-th

Install

pip install pythaiasr

For Wav2Vec2 with language model: if you want to use wannaphong/wav2vec2-large-xlsr-53-th-cv8-* model with language model, you needs to install by the step.

pip install pythaiasr[lm]
pip install https://github.com/kpu/kenlm/archive/refs/heads/master.zip

Usage

from pythaiasr import asr

file = "a.wav"
print(asr(file))

API

asr(data: str, model: str = _model_name, lm: bool=False, device: str=None, sampling_rate: int=16_000)

Options for model

You can read about models from the list:

Docker

To use this inside of Docker do the following:

docker build -t <Your Tag name> .
docker run docker run --entrypoint /bin/bash -it <Your Tag name>

You will then get access to a interactive shell environment where you can use python with all packages installed.