Updated Cargo.toml and audio_transcription example to not fail cargo test

This commit is contained in:
James Bruska 2023-03-23 12:38:54 -04:00
parent cf278027ee
commit 05d072ffc4
2 changed files with 8 additions and 4 deletions

View file

@ -16,6 +16,9 @@ repository = "https://github.com/tazz4843/whisper-rs"
[dependencies] [dependencies]
whisper-rs-sys = { path = "sys", version = "0.3" } whisper-rs-sys = { path = "sys", version = "0.3" }
[dev-dependencies]
hound = "3.5.0"
[features] [features]
simd = [] simd = []

View file

@ -1,9 +1,10 @@
// This example is not going to build in this folder. // This example is not going to build in this folder.
// You need to copy this code into your project and add the whisper_rs dependency in your cargo.toml // You need to copy this code into your project and add the dependencies whisper_rs and hound in your cargo.toml
use std::fs::File; use std::fs::File;
use std::io::Write; use std::io::Write;
use whisper_rs::{FullParams, SamplingStrategy, WhisperContext}; use whisper_rs::{FullParams, SamplingStrategy, WhisperContext};
use hound;
/// Loads a context and model, processes an audio file, and prints the resulting transcript to stdout. /// Loads a context and model, processes an audio file, and prints the resulting transcript to stdout.
fn main() { fn main() {
@ -14,7 +15,7 @@ fn main() {
// Create a params object for running the model. // Create a params object for running the model.
// Currently, only the Greedy sampling strategy is implemented, with BeamSearch as a WIP. // Currently, only the Greedy sampling strategy is implemented, with BeamSearch as a WIP.
// The number of past samples to consider defaults to 0. // The number of past samples to consider defaults to 0.
let mut params = FullParams::new(SamplingStrategy::Greedy { n_past: 0 }); let mut params = FullParams::new(SamplingStrategy::Greedy { best_of: 0 });
// Edit params as needed. // Edit params as needed.
// Set the number of threads to use to 1. // Set the number of threads to use to 1.
@ -22,7 +23,7 @@ fn main() {
// Enable translation. // Enable translation.
params.set_translate(true); params.set_translate(true);
// Set the language to translate to to English. // Set the language to translate to to English.
params.set_language("en"); params.set_language(Some("en"));
// Disable anything that prints to stdout. // Disable anything that prints to stdout.
params.set_print_special(false); params.set_print_special(false);
params.set_print_progress(false); params.set_print_progress(false);