Metadata-Version: 2.1
Name: wenet-stt
Version: 0.2.0
Summary: Simple Python library, distributed via binary wheels with few direct dependencies, for easily using wav2vec 2.0 models for speech recognition.
Home-page: https://github.com/daanzu/wenet_stt_python
Author: David Zurow
Author-email: daanzu@gmail.com
License: AGPL-3.0
Project-URL: Bug Reports, https://github.com/daanzu/wenet_stt/issues
Project-URL: Funding, https://github.com/sponsors/daanzu
Project-URL: Source, https://github.com/daanzu/wenet_stt/
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.6, <4
Description-Content-Type: text/markdown
Requires-Dist: cffi (~=1.12)
Requires-Dist: numpy (!=1.19.4,~=1.16)
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'

# Wenet STT Python

> **Beta Software**

> Simple Python library, distributed via binary wheels with few direct dependencies, for easily using [WeNet](https://github.com/wenet-e2e/wenet) models for speech recognition.

[![Donate](https://img.shields.io/badge/donate-GitHub-pink.svg)](https://github.com/sponsors/daanzu)
[![Donate](https://img.shields.io/badge/donate-Patreon-orange.svg)](https://www.patreon.com/daanzu)
[![Donate](https://img.shields.io/badge/donate-PayPal-green.svg)](https://paypal.me/daanzu)

Requirements:
* Python 3.7+
* Platform: Linux x64 (Windows is a work in progress; MacOS may work; PRs welcome)
* Python package requirements: `cffi`, `numpy`
* Wenet Model (must be "runtime" format)
    * Several are available ready-to-go on this project's [releases page](https://github.com/daanzu/wenet_stt_python/releases/tag/models) and below.

Models:

| Model | Download Size |
|--------|--------|
| [gigaspeech_20210728_u2pp_conformer](https://github.com/daanzu/wenet_stt_python/releases/download/models/gigaspeech_20210728_u2pp_conformer.zip) | 549 MB |
| [gigaspeech_20210811_conformer_bidecoder](https://github.com/daanzu/wenet_stt_python/releases/download/models/gigaspeech_20210811_conformer_bidecoder.zip) | 540 MB |

## Usage

```python
from wenet_stt import WenetSTT
decoder = WenetSTT(WenetSTT.build_config('model_dir'))

import wave
with wave.open('tests/test.wav', 'rb') as wav_file:
    wav_samples = wav_file.readframes(wav_file.getnframes())

assert decoder.decode(wav_samples).strip().lower() == 'it depends on the context'
```

Also contains a simple CLI interface for recognizing `wav` files:

```bash
$ python -m wenet_stt decode model test.wav
IT DEPENDS ON THE CONTEXT
$ python -m wenet_stt decode model test.wav test.wav
IT DEPENDS ON THE CONTEXT
IT DEPENDS ON THE CONTEXT
$ python -m wenet_stt -h
usage: python -m wenet_stt [-h] {decode} ...

positional arguments:
  {decode}    sub-command
    decode    decode one or more WAV files

optional arguments:
  -h, --help  show this help message and exit
```

## Installation/Building

Recommended installation via wheel from pip (requires a recent version of pip):

```bash
python -m pip install wenet_stt
```

To build package for use locally:

```bash
python setup.py bdist_wheel
```

To build package for publishing:

```bash
building/dockcross-manylinux2014-x64 bash building/build-wheel-dockcross.sh manylinux2014_x86_64
```

## Author

* David Zurow ([@daanzu](https://github.com/daanzu))

## License

This project is licensed under the GNU Affero General Public License v3 (AGPL-3.0-or-later). See the [LICENSE file](LICENSE) for details. If this license is problematic for you, please contact me.

## Acknowledgments

* Contains and uses code from [WeNet](https://github.com/wenet-e2e/wenet), licensed under the Apache-2.0 License, and other transitive dependencies (see source).


