#grpc-client #grpc #client #jarvis #riva

nvidia_riva

Nvidia Riva的gRPC客户端的Rust语言实现

3个不稳定版本

0.2.0 2023年7月28日
0.1.2 2023年7月28日
0.1.1 2022年11月9日
0.1.0 2022年10月31日

#35 in #grpc-client

Download history 47/week @ 2024-04-17 17/week @ 2024-04-24 16/week @ 2024-05-01 47/week @ 2024-05-08 24/week @ 2024-05-15 70/week @ 2024-05-22 71/week @ 2024-05-29 54/week @ 2024-06-05 64/week @ 2024-06-12 100/week @ 2024-06-19 65/week @ 2024-06-26 56/week @ 2024-07-03 57/week @ 2024-07-10 89/week @ 2024-07-17 98/week @ 2024-07-24 55/week @ 2024-07-31

每月305次下载

Apache-2.0 OR MIT

79KB
80

Rust Documentation Crates.io

Nvidia Riva或Jarvis的GRPC客户端

如何安装

nvidia_riva 添加到您的依赖中

[dependencies]
# ...
nvidia_riva = 0.2

入门指南

RivaSpeechRecognitionClient 示例

use nvidia_riva::asr::riva_speech_recognition_client::RivaSpeechRecognitionClient;
use nvidia_riva::asr::{RecognitionConfig, RecognizeRequest};
use nvidia_riva::AudioEncoding;

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
    let mut riva_client =
        RivaSpeechRecognitionClient::connect("http://127.0.0.1:50051").await?;

    let bytes = std::fs::read("./assets/data/test.wav")
        .expect("Unable read `test.wav` file");
    let riva_request = RecognizeRequest {
        config: Some(RecognitionConfig {
            encoding: AudioEncoding::LinearPcm as i32,
            sample_rate_hertz: 16000,
            language_code: String::from("en-US"),
            max_alternatives: 1,
            profanity_filter: false,
            speech_contexts: vec![],
            audio_channel_count: 1,
            enable_word_time_offsets: false,
            enable_automatic_punctuation: false,
            enable_separate_recognition_per_channel: false,
            model: "riva-asr".to_string(),
            verbatim_transcripts: true,
            custom_configuration: Default::default(),
        }),
        audio: bytes,
    };
    let riva_result = riva_client.recognize(riva_request).await;
    println!("{:?}", riva_result);
    Ok(())
}

依赖项

~5–7MB
~124K SLoC