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.
Release files for pvcheetah 4.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pvcheetah-4.1.2.tar.gz | 41.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pvcheetah-4.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 82.5 MB
Release files / pvcheetah-4.1.2.tar.gz
| Download URL | pvcheetah-4.1.2.tar.gz |
|---|---|
| Size | 41.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7df4f59c3214084dc06408e73383d24dce6e9319da89067b201e4901e2d9b66b
|
|
BLAKE2b-256 checksum How to use checksums |
a8034ed943020e7386d08a318a15e2b2e263030a376d24d3eff8d5c4fad0121b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / pvcheetah-4.1.2-py3-none-any.whl
| Download URL | pvcheetah-4.1.2-py3-none-any.whl |
|---|---|
| Size | 41.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
862953e0e2c16fabdb96e1e8da4e990babb0390b4e6381f1cf67f51303490570
|
|
BLAKE2b-256 checksum How to use checksums |
eff0370215cc0943983b8b75a5c55e161c45e8d99d297d3a2a2207967ebf1fa1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|