Crates.io | pv_cheetah |
lib.rs | pv_cheetah |
version | 2.0.3 |
source | src |
created_at | 2022-03-19 17:01:38.104326 |
updated_at | 2024-09-17 23:47:07.362115 |
description | The Rust bindings for Picovoice's Cheetah library |
homepage | https://picovoice.ai/platform/cheetah/ |
repository | https://github.com/Picovoice/cheetah |
max_upload_size | 52428800 |
id | 553238 |
size | 34,502,783 |
Made in Vancouver, Canada by Picovoice
Cheetah is an on-device streaming speech-to-text engine. Cheetah is:
First you will need Rust and Cargo installed on your system.
To add the cheetah library into your app, add pv_cheetah
to your apps Cargo.toml
manifest:
[dependencies]
pv_cheetah = "*"
If you prefer to clone the repo and use it locally, first run copy.sh
.
(NOTE: on Windows, Git Bash or another bash shell is required, or you will have to manually copy the libs into the project).
Then you can reference the local binding location:
[dependencies]
pv_cheetah = { path = "/path/to/rust/binding" }
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
.
Create an instance of the engine and transcribe audio:
use cheetah::CheetahBuilder;
fn next_audio_frame() -> Vec<i16> {
// get audio frame
}
let access_key = "${ACCESS_KEY}"; // AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)
let cheetah: Cheetah = CheetahBuilder::new().access_key(access_key).init().expect("Unable to create Cheetah");
if let Ok(cheetahTranscript) = cheetah.process(&next_audio_frame()) {
println!("{}", cheetahTranscript.transcript)
if cheetahTranscript.is_endpoint {
if let Ok(cheetahTranscript) = cheetah.flush() {
println!("{}", cheetahTranscript.transcript)
}
}
}
Replace ${ACCESS_KEY}
with yours obtained from Picovoice Console.
The model file contains the parameters for the Cheetah engine. You may create bespoke language models using Picovoice Console and then pass in the relevant file.
The Cheetah Rust demo project is a Rust console app that allows for processing real-time audio (i.e. microphone) and files using Cheetah.