Merge pull request #7 from rockerBOO/patch-1

Update readme with new usage
This commit is contained in:
0/0 2022-12-15 08:15:09 -07:00 committed by GitHub
commit b81c6c9454
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -4,12 +4,14 @@ Rust bindings to [whisper.cpp](https://github.com/ggerganov/whisper.cpp/)
## Usage
```rust
use whisper_rs::{WhisperContext, FullParams, SamplingStrategy};
fn main() {
// load a context and model
let mut ctx = WhisperContext::new("path/to/model").expect("failed to load model");
// create a params object
let mut params = FullParams::new(DecodeStrategy::Greedy { n_past: 0 });
let mut params = FullParams::new(SamplingStrategy::Greedy { n_past: 0 });
// assume we have a buffer of audio data
// here we'll make a fake one, floating point samples, 32 bit, 16KHz, mono