| Crates.io | ragzilla-transcription |
| lib.rs | ragzilla-transcription |
| version | 0.1.0 |
| created_at | 2025-03-21 20:39:02.072601+00 |
| updated_at | 2025-03-21 20:39:02.072601+00 |
| description | A Rust library for transcribing audio to text using OpenAI's GPT-4o transcription API |
| homepage | |
| repository | https://github.com/excoffierleonard/ragzilla |
| max_upload_size | |
| id | 1601136 |
| size | 66,006 |
A Rust library for transcribing audio to text using OpenAI's GPT-4o transcription API.
Add the following to your Cargo.toml file:
[dependencies]
ragzilla-transcription = "0.1.0"
use ragzilla_transcription::transcribe;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let api_key = std::env::var("OPENAI_API_KEY").expect("OPENAI_API_KEY must be set");
let audio_data = fs::read("path/to/audio.mp3").expect("Could not read audio file");
let transcription = transcribe(&audio_data, &api_key).await?;
println!("Transcription: {}", transcription);
Ok(())
}
transcribepub async fn transcribe(audio_data: &[u8], api_key: &str) -> Result<String, reqwest::Error>
Transcribes the provided audio data to text using OpenAI's GPT-4o transcription service.
audio_data: Raw audio data as a byte sliceapi_key: Your OpenAI API keyReturns a Result containing the transcribed text as a string.
MIT License