Git Product home page Git Product logo

jbaber / vosk-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alphacep/vosk-api

0.0 2.0 0.0 311 KB

Kaldi API for offline speech recognition on Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node

License: Apache License 2.0

CMake 4.18% C++ 45.67% Java 19.10% Shell 6.48% JavaScript 0.09% Python 9.06% Makefile 3.97% SWIG 2.79% C# 1.41% C 3.51% Swift 3.73% Objective-C 0.02%

vosk-api's Introduction

Build Status

РУС

中文

Vosk is a speech recognition toolkit. The best things in Vosk are:

  1. Supports 8 languages - English, German, French, Spanish, Portuguese, Chinese, Russian, Vietnamese. More is coming.
  2. Works offline even on lightweight devices - Raspberry Pi, Android, iOS
  3. Installs with simple pip3 install vosk
  4. Portable models per language is just only 50Mb but there are much bigger server models available.
  5. Provides streaming API for the best user experience (unlike popular speech-recognition python package)
  6. There bindings for different prograbmming languages too - java/csharp/javascript etc.
  7. Allows quick reconfiguration of vocabulary for best accuracy.
  8. Supports speaker identification beside simple speech recognition

Android build

cd android
gradle build

Please note that medium blog post about 64-bit is not relevant anymore, the script builds x86, arm64 and armv7 libraries automatically without any modifications.

For example of Android application using Vosk-API check https://github.com/alphacep/kaldi-android-demo project

iOS build

Available on request. Drop as a mail at [email protected].

Python installation from Pypi

The easiest way to install vosk api is with pip. You do not have to compile anything. We currently support only Linux on x86_64 and Raspberry Pi. Other systems (windows, mac) will come soon.

Make sure you have newer pip and python:

  • Python version >= 3.4
  • pip version >= 19.0

Uprade python and pip if needed. Then install vosk on Linux with a simple command

pip3 install vosk

Websocket Server and GRPC server

We also provide a websocket server and grpc server which can be used in telephony and other applications. With bigger models adapted for 8khz audio it provides more accuracy.

The server is installed with docker and can run with a single command:

docker run -d -p 2700:2700 alphacep/kaldi-en:latest

For details see https://github.com/alphacep/vosk-server

Compilation from source

If you still want to build from scratch, you can compile Kaldi and Vosk yourself. The compilation is straightforward but might be a little confusing for newbie. In case you want to follow this, please watch the errors.

Kaldi compilation for local python, node and java modules

git clone -b lookahead --single-branch https://github.com/alphacep/kaldi
cd kaldi/tools
make

install all dependencies and repeat make if needed

extras/install_openblas.sh
cd ../src
./configure --mathlib=OPENBLAS --shared --use-cuda=no
make -j 10

Python module build

Then build the python module

export KALDI_ROOT=<KALDI_ROOT>
cd python
python3 setup.py install

Running the example code with python

Run like this:

cd vosk-api/python/example
wget https://github.com/alphacep/kaldi-android-demo/releases/download/2020-01/alphacep-model-android-en-us-0.3.tar.gz
tar xf alphacep-model-android-en-us-0.3.tar.gz 
mv alphacep-model-android-en-us-0.3 model-en
python3 ./test_simple.py test.wav

To run with your audio file make sure it has proper format - PCM 16khz 16bit mono, otherwise decoding will not work.

You can find other examples of using a microphone, decoding with a fixed small vocabulary or speaker identification setup in python/example subfolder

Java example API build

Or Java

cd java && KALDI_ROOT=<KALDI_ROOT> make
wget https://github.com/alphacep/kaldi-android-demo/releases/download/2020-01/alphacep-model-android-en-us-0.3.tar.gz
tar xf alphacep-model-android-en-us-0.3.tar.gz 
mv alphacep-model-android-en-us-0.3 model
make run

C# build

Or C#

cd csharp && KALDI_ROOT=<KALDI_ROOT> make
wget https://github.com/alphacep/kaldi-android-demo/releases/download/2020-01/alphacep-model-android-en-us-0.3.tar.gz
tar xf alphacep-model-android-en-us-0.3.tar.gz 
mv alphacep-model-android-en-us-0.3 model
mono test.exe

Models for different languages

For information about models see the documentation on available models.

Contact Us

If you have any questions, feel free to

vosk-api's People

Contributors

nshmyrev avatar dremendes avatar camillem avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.