simple_transcribe_rs

Crates.iosimple_transcribe_rs
lib.rssimple_transcribe_rs
version1.0.3
sourcesrc
created_at2024-01-04 21:28:56.21787
updated_at2024-01-05 20:50:19.384872
descriptionAudio to text transcription library written in rust that utilizes whisper-rs bindings.
homepagehttps://github.com/Marble879/SimpleTranscribe-rs
repositoryhttps://github.com/Marble879/SimpleTranscribe-rs
max_upload_size
id1089038
size2,641,790
Younis Akel (Marble879)

documentation

README

SimpleTranscribe-rs 🔈 📖

An audio to text transcription library written in rust that utilizes Whisper-rs bindings.

What is SimpleTranscribe-rs?

SimpleTranscribe-rs is a library written in Rust with the goal of making audio to text transcription simple for developers. SimpleTranscribe-rs handles different aspects of setting up audio to text transcription, such as automatically downloading required whisper text-to-speech models. The aim is for developers to be able to incorporate transcription in their projects quickly 🌩ī¸

Features

  • Automatically downloads Models that have no already been installed. Supported models:

    • Tiny
    • Base
    • Small
    • Medium
    • Large
  • Transcribes audio from different file types such as:

    • mp3
    • wav

Getting started

To use SimpleTranscribe-rs, simply add it to your project's cargo.toml:

[dependencies]
simple_transcribe_rs = "1.0.1"
tokio = { version = "1.35.1", features = ["full"] }

Due to the nature of downloading models, it is necessary to await instantiations of the model handler. Therefore an async runtime is required. Tokio is what is used internally in the library and has also been tested with, and therefore is the recommended runtime for this library.

Usage

To use SimpleTranscribe-rs, the model handler first needs to be used to setup and prepare the language model. Afterwards, the transcriber can be used to convert audio files to text. The following snippet depicts an example of this:

use simple_transcribe_rs::model_handler;
use simple_transcribe_rs::transcriber;

#[tokio::main]
async fn main() {
    let m = model_handler::ModelHandler::new("tiny", "models/").await;
    let trans = transcriber::Transcriber::new(m);
    let result = trans.transcribe("src/test_data/test.mp3", None).unwrap();
    let text = result.get_text();
    let start = result.get_start_timestamp();
    let end = result.get_end_timestamp();
    println!("start[{}]-end[{}] {}", start, end, text);
}

The snippet can be run via: cargo run --example usage_example

Commit count: 0

cargo fmt