Skip to main content

Cheetah Binding for Python

Cheetah Speech-to-Text Engine

Made in Vancouver, Canada by Picovoice

Cheetah is an on-device streaming speech-to-text engine. Cheetah is:

  • Private; All voice processing runs locally.
  • Accurate
  • Compact and Computationally-Efficient
  • Cross-Platform:
    • Linux (x86_64), macOS (x86_64, arm64), and Windows (x86_64, arm64)
    • Android and iOS
    • Chrome, Safari, Firefox, and Edge
    • Raspberry Pi (3, 4, 5)

Compatibility

  • Python 3.9+
  • Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5).

Installation

pip3 install pvcheetah

AccessKey

Cheetah requires a valid Picovoice AccessKey at initialization. AccessKey acts as your credentials when using Cheetah SDKs. You can get your AccessKey for free. Make sure to keep your AccessKey secret. Signup or Login to Picovoice Console to get your AccessKey.

Usage

Basic Transcription

Create an instance of the engine and transcribe audio:

import pvcheetah

handle = pvcheetah.create(access_key='${ACCESS_KEY}')

def get_next_audio_frame():
    pass

while True:
    partial_transcript, is_endpoint = handle.process(get_next_audio_frame())
    if is_endpoint:
        final_transcript = handle.flush()

Replace ${ACCESS_KEY} with yours obtained from Picovoice Console. When done be sure to explicitly release the resources using handle.delete().

Annotated Transcription

Create an instance of the engine and get the audio transcription and word-level metadata:

import pvcheetah

handle = pvcheetah.create(access_key='${ACCESS_KEY}')

def get_next_audio_frame():
    pass

while True:
    partial_output = handle.process_annotated(get_next_audio_frame())
    partial_transcript = partial_output.transcript
    partial_words = partial_output.words
    is_endpoint = partial_output.is_endpoint

    if is_endpoint:
        final_output = handle.flush_annotated()
        final_transcript = final_output.transcript
        final_words = final_output.words

Replace ${ACCESS_KEY} with yours obtained from Picovoice Console. When done be sure to explicitly release the resources using handle.delete().

Language Model

The Cheetah Python SDK comes preloaded with a default English language model (.pv file). Default models for other supported languages can be found in lib/common.

Create custom language models using the Picovoice Console. Here you can train language models with custom vocabulary and boost words in the existing vocabulary.

Pass in the .pv file via the model_path argument:

cheetah = pvcheetah.create(
    access_key='${ACCESS_KEY}',
    model_path='${MODEL_FILE_PATH}')

Train Models over API

You can train models over API without going to the console:

train_model_from_words(
        "${ACCESS_KEY}",                                                   # AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
        "${OUTPUT_PATH}",                                                  # Path to save the newly trained model.
        "${LANGUAGE}",                                                     # Two-character language code.
        {"${NEW_WORD}": set(["${PRONUNCIATION1}", "${PRONUNCIATION2}"])},  # New words with optional custom pronunciation to add to the model.
        set(["${BOOST_WORD1}", "${BOOST_WORD2}"]))                         # Boost words.

(or)

train_model_from_yaml(
        "${ACCESS_KEY}",   # AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
        "${OUTPUT_PATH}",  # Path to save the newly trained model.
        "${LANGUAGE}",     # Two-character language code.
        "${YAML_PATH}")    # Path to YAML configuration file.

Check Cheetah Model API docs for a list of supported languages.

Demos

pvcheetahdemo provides command-line utilities for processing audio using Cheetah.

Metadata

Release files for pvcheetah 4.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pvcheetah 4.2.0
File Size Uploaded
pvcheetah-4.2.0.tar.gz 42.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pvcheetah 4.2.0
File Interpreter ABI Platform
pvcheetah-4.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 84.9 MB

Release files / pvcheetah-4.2.0.tar.gz

Download URL pvcheetah-4.2.0.tar.gz
Size 42.5 MB
Tags Source
SHA-256 checksum
How to use checksums
2cd3b9e7fa84c6d71bc5da93cffe6bed6d817150f16d4ec091312d9b638596e4
BLAKE2b-256 checksum
How to use checksums
db87ba532af69109ac8ed18a1b240211079dc89ddd9f0fe11e4d1b7beea14fb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / pvcheetah-4.2.0-py3-none-any.whl

Download URL pvcheetah-4.2.0-py3-none-any.whl
Size 42.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
54cfb1ff4285500a5bb78212c0f595d041cbb2720da0e0b0c33bf25e7c8f4246
BLAKE2b-256 checksum
How to use checksums
c5332faa4be252d4b4683b7616cf8f0d873449f3a8ea57824d088ec82cdde0f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

4.2.0 This release

2 release files

4.1.2

2 release files

4.1.1

2 release files

4.1.0

2 release files

4.0.4

2 release files

4.0.3

2 release files

4.0.2

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page