lib-ify as /rust-whisper-lib
parent
2883830dbe
commit
f864d4dfc7
File diff suppressed because it is too large
Load Diff
|
|
@ -6,3 +6,11 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
whisper-rs = { path = "../gitea-whisper-rs", version = "0.8.0" }
|
||||||
|
wav = "1"
|
||||||
|
tokio = "1.27"
|
||||||
|
cpal = "0.15.2"
|
||||||
|
signal-hook = "0.3.17"
|
||||||
|
byteorder = "1.5.0"
|
||||||
|
chrono = "0.4.31"
|
||||||
|
clap = { version = "4.4.10", features = ["derive"] }
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,363 @@
|
||||||
pub fn add(left: usize, right: usize) -> usize {
|
use whisper_rs::{WhisperContext, FullParams, SamplingStrategy, WhisperError};
|
||||||
left + right
|
use cpal::traits::{HostTrait, DeviceTrait, StreamTrait};
|
||||||
|
use signal_hook::{iterator::Signals, consts::signal::SIGINT};
|
||||||
|
use std::time::{Duration, Instant};
|
||||||
|
use clap::Parser;
|
||||||
|
use std::thread;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
|
#[derive(Parser, Debug)]
|
||||||
|
pub struct Flags {
|
||||||
|
#[arg(long, default_value = "./models/ggml-tiny.en.bin")]
|
||||||
|
pub model: String,
|
||||||
|
|
||||||
|
#[arg(long, default_value = "8")]
|
||||||
|
pub threads: i32,
|
||||||
|
|
||||||
|
#[arg(long, default_value = "5")]
|
||||||
|
pub stream_step: u64,
|
||||||
|
#[arg(long, default_value = "0.6")]
|
||||||
|
pub stream_retain: f32,
|
||||||
|
#[arg(long, default_value = "0.3")]
|
||||||
|
pub stream_head: f32,
|
||||||
|
#[arg(long, default_value = "0.3")]
|
||||||
|
pub stream_tail: f32,
|
||||||
|
|
||||||
|
pub wav: Option<String>,
|
||||||
|
|
||||||
|
#[arg(long, default_value = "false")]
|
||||||
|
pub debug: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
pub fn main<F>(flags: Flags, handler_fn: F) where F: FnMut(Result<Whispered, String>) + Send + 'static {
|
||||||
mod tests {
|
let w = new_whisper_service(
|
||||||
use super::*;
|
flags.model,
|
||||||
|
flags.threads,
|
||||||
|
flags.stream_head,
|
||||||
|
flags.stream_tail,
|
||||||
|
handler_fn,
|
||||||
|
).unwrap();
|
||||||
|
let stream_retain = (flags.stream_retain * 16_000.0) as usize;
|
||||||
|
let stream_step = Duration::new(flags.stream_step, 0);
|
||||||
|
match flags.wav {
|
||||||
|
Some(wav) => {
|
||||||
|
let (header, data) = wav::read(
|
||||||
|
&mut std::fs::File::open(wav).expect("failed to open $WAV"),
|
||||||
|
).expect("failed to decode $WAV");
|
||||||
|
assert!(header.channel_count == 1);
|
||||||
|
assert!(header.sampling_rate == 16_000);
|
||||||
|
let data16 = data.as_sixteen().expect("wav is not 32bit floats");
|
||||||
|
let audio_data = &whisper_rs::convert_integer_to_float_audio(&data16);
|
||||||
|
|
||||||
#[test]
|
w.transcribe(&audio_data);
|
||||||
fn it_works() {
|
},
|
||||||
let result = add(2, 2);
|
None => {
|
||||||
assert_eq!(result, 4);
|
match &flags.debug {
|
||||||
}
|
true => { File::create("/tmp/page.rawf32audio").unwrap(); },
|
||||||
|
false => {},
|
||||||
|
};
|
||||||
|
let mut buffer = vec![];
|
||||||
|
let mut last = Instant::now();
|
||||||
|
new_listener().listen(move |data: Vec<f32>| {
|
||||||
|
data.iter().for_each(|x| buffer.push(*x));
|
||||||
|
if Instant::now() - last > stream_step {
|
||||||
|
w.transcribe_async(&buffer).unwrap();
|
||||||
|
|
||||||
|
match &flags.debug {
|
||||||
|
true => {
|
||||||
|
let mut f = File::options().append(true).open("/tmp/page.rawf32audio").unwrap();
|
||||||
|
let mut wav_data = vec![];
|
||||||
|
for i in buffer.iter() {
|
||||||
|
for j in i.to_le_bytes() {
|
||||||
|
wav_data.push(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
f.write_all(wav_data.as_slice()).unwrap();
|
||||||
|
},
|
||||||
|
false => {},
|
||||||
|
};
|
||||||
|
|
||||||
|
for i in 0..stream_retain {
|
||||||
|
buffer[i] = buffer[buffer.len() - stream_retain + i];
|
||||||
|
}
|
||||||
|
buffer.truncate(stream_retain);
|
||||||
|
last = Instant::now();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
struct WhisperService {
|
||||||
|
jobs: std::sync::mpsc::SyncSender<AWhisper>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_whisper_service<F>(model_path: String, threads: i32, stream_head: f32, stream_tail: f32, handler_fn: F) -> Result<WhisperService, String> where F: FnMut(Result<Whispered, String>) + Send + 'static {
|
||||||
|
match new_whisper_engine(model_path, threads) {
|
||||||
|
Ok(engine) => {
|
||||||
|
let mut whisper = new_whisper_impl(engine, stream_head, stream_tail, handler_fn);
|
||||||
|
let (send, recv) = std::sync::mpsc::sync_channel(100);
|
||||||
|
thread::spawn(move || { whisper.transcribe_asyncs(recv); });
|
||||||
|
Ok(WhisperService{jobs: send})
|
||||||
|
},
|
||||||
|
Err(msg) => Err(format!("failed to initialize engine: {}", msg)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WhisperService {
|
||||||
|
fn transcribe(&self, data: &Vec<f32>) {
|
||||||
|
let (send, recv) = std::sync::mpsc::sync_channel(0);
|
||||||
|
self._transcribe_async(data, Some(send)).unwrap();
|
||||||
|
recv.recv().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn transcribe_async(&self, data: &Vec<f32>) -> Result<(), String> {
|
||||||
|
self._transcribe_async(data, None)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn _transcribe_async(&self, data: &Vec<f32>, ack: Option<std::sync::mpsc::SyncSender<bool>>) -> Result<(), String> {
|
||||||
|
match self.jobs.try_send(AWhisper{
|
||||||
|
data: data.clone().to_vec(),
|
||||||
|
ack: ack,
|
||||||
|
}) {
|
||||||
|
Ok(_) => Ok(()),
|
||||||
|
Err(msg) => Err(format!("failed to enqueue transcription: {}", msg)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct WhisperImpl {
|
||||||
|
engine: WhisperEngine,
|
||||||
|
stream_head: f32,
|
||||||
|
stream_tail: f32,
|
||||||
|
handler_fn: Option<Box<dyn FnMut(Result<Whispered, String>) + Send + 'static>>
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_whisper_impl<F>(engine: WhisperEngine, stream_head: f32, stream_tail: f32, handler_fn: F) -> WhisperImpl where F: FnMut(Result<Whispered, String>) + Send + 'static {
|
||||||
|
WhisperImpl {
|
||||||
|
engine: engine,
|
||||||
|
stream_head: stream_head,
|
||||||
|
stream_tail: stream_tail,
|
||||||
|
handler_fn: Some(Box::new(handler_fn)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WhisperImpl {
|
||||||
|
fn transcribe_asyncs(&mut self, recv: std::sync::mpsc::Receiver<AWhisper>) {
|
||||||
|
loop {
|
||||||
|
match recv.recv() {
|
||||||
|
Ok(job) => {
|
||||||
|
let result = self.transcribe(&job).is_ok();
|
||||||
|
match job.ack {
|
||||||
|
Some(ack) => {
|
||||||
|
ack.send(result).unwrap();
|
||||||
|
},
|
||||||
|
None => (),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
Err(_) => return,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn transcribe(&mut self, a_whisper: &AWhisper) -> Result<(), ()> {
|
||||||
|
match self.engine.transcribe(&a_whisper.data) {
|
||||||
|
Ok(result) => {
|
||||||
|
self.on_success(&result);
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
Err(msg) => {
|
||||||
|
self.on_error(msg.to_string());
|
||||||
|
Err(())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_success(&mut self, whispered: &Whispered) {
|
||||||
|
let result = whispered
|
||||||
|
.after(&(self.stream_head * 100.0))
|
||||||
|
.before(&(self.stream_tail * 100.0));
|
||||||
|
(self.handler_fn.as_mut().unwrap())(Ok(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_error(&mut self, msg: String) {
|
||||||
|
(self.handler_fn.as_mut().unwrap())(Err(format!("failed to transcribe: {}", &msg)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct WhisperEngine {
|
||||||
|
ctx: WhisperContext,
|
||||||
|
threads: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_whisper_engine(model_path: String, threads: i32) -> Result<WhisperEngine, String> {
|
||||||
|
match WhisperContext::new(&model_path) {
|
||||||
|
Ok(ctx) => Ok(WhisperEngine{ctx: ctx, threads: threads}),
|
||||||
|
Err(msg) => Err(format!("failed to load {}: {}", model_path, msg)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WhisperEngine {
|
||||||
|
fn transcribe(&self, data: &Vec<f32>) -> Result<Whispered, WhisperError> {
|
||||||
|
let mut params = FullParams::new(SamplingStrategy::Greedy { best_of: 0 });
|
||||||
|
params.set_no_context(true);
|
||||||
|
params.set_n_threads(self.threads);
|
||||||
|
params.set_translate(false);
|
||||||
|
params.set_detect_language(false);
|
||||||
|
params.set_language(Some("en"));
|
||||||
|
params.set_print_special(false);
|
||||||
|
params.set_print_progress(false);
|
||||||
|
params.set_print_realtime(false);
|
||||||
|
params.set_print_timestamps(false);
|
||||||
|
|
||||||
|
let mut state = self.ctx.create_state()?;
|
||||||
|
state.full(params, &data[..])?;
|
||||||
|
|
||||||
|
let mut result = new_whispered();
|
||||||
|
let num_segments = state.full_n_segments()?;
|
||||||
|
for i in 0..num_segments {
|
||||||
|
let data = state.full_get_segment_text(i)?;
|
||||||
|
let start = state.full_get_segment_t0(i)?;
|
||||||
|
let stop = state.full_get_segment_t1(i)?;
|
||||||
|
result.push(data, start, stop);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AWhisper {
|
||||||
|
data: Vec<f32>,
|
||||||
|
ack: Option<std::sync::mpsc::SyncSender<bool>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct Whispered {
|
||||||
|
pub data: Vec<AWhispered>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct AWhispered {
|
||||||
|
pub data: String,
|
||||||
|
pub offset: i64,
|
||||||
|
pub length: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_whispered() -> Whispered {
|
||||||
|
Whispered{data: vec![]}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_a_whispered(data: String, start: i64, stop: i64) -> AWhispered {
|
||||||
|
AWhispered{
|
||||||
|
data: data,
|
||||||
|
offset: start.clone(),
|
||||||
|
length: stop - start,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Whispered {
|
||||||
|
pub fn to_string(&self) -> String {
|
||||||
|
let mut result = "".to_string();
|
||||||
|
for i in 0..self.data.len() {
|
||||||
|
result = format!("{} {}", result, &self.data[i].data);
|
||||||
|
}
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
fn after(&self, t: &f32) -> Whispered {
|
||||||
|
let mut result = new_whispered();
|
||||||
|
self.data
|
||||||
|
.iter()
|
||||||
|
.filter(|x| x.offset as f32 >= *t)
|
||||||
|
.for_each(|x| result.data.push(x.clone()));
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
fn before(&self, t: &f32) -> Whispered {
|
||||||
|
let mut result = new_whispered();
|
||||||
|
let end = match self.data.iter().map(|x| x.offset + x.length).max() {
|
||||||
|
Some(x) => x,
|
||||||
|
None => 1,
|
||||||
|
};
|
||||||
|
let t = (end as f32) - *t;
|
||||||
|
self.data
|
||||||
|
.iter()
|
||||||
|
.filter(|x| ((x.offset) as f32) <= t)
|
||||||
|
.for_each(|x| result.data.push(x.clone()));
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
fn push(&mut self, data: String, start: i64, stop: i64) {
|
||||||
|
let words: Vec<_> = data.split_whitespace().collect();
|
||||||
|
let per_word = (stop - start) / (words.len() as i64);
|
||||||
|
for i in 0..words.len() {
|
||||||
|
let start = (i as i64) * per_word;
|
||||||
|
let stop = start.clone() + per_word;
|
||||||
|
self.data.push(new_a_whispered(words[i].to_string(), start, stop));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Listener {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_listener() -> Listener {
|
||||||
|
Listener{}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Listener {
|
||||||
|
fn listen(self, mut cb: impl FnMut(Vec<f32>)) {
|
||||||
|
let (send, recv) = std::sync::mpsc::sync_channel(100);
|
||||||
|
thread::spawn(move || { self._listen(send); });
|
||||||
|
loop {
|
||||||
|
match recv.recv() {
|
||||||
|
Ok(msg) => cb(msg),
|
||||||
|
Err(_) => return,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn _listen(self, send: std::sync::mpsc::SyncSender<Vec<f32>>) {
|
||||||
|
let host = cpal::default_host();
|
||||||
|
let device = host.default_input_device().unwrap();
|
||||||
|
let cfg = device.supported_input_configs()
|
||||||
|
.unwrap()
|
||||||
|
.filter(|x| x.sample_format() == cpal::SampleFormat::F32)
|
||||||
|
.nth(0)
|
||||||
|
.unwrap()
|
||||||
|
.with_max_sample_rate();
|
||||||
|
|
||||||
|
let downsample_ratio = cfg.channels() as f32 * (cfg.sample_rate().0 as f32 / 16_000.0);
|
||||||
|
let stream = device.build_input_stream(
|
||||||
|
&cfg.clone().into(),
|
||||||
|
move |data: &[f32], _: &cpal::InputCallbackInfo| {
|
||||||
|
let mut downsampled_data = vec![];
|
||||||
|
for i in 0..(data.len() as f32 / downsample_ratio) as usize {
|
||||||
|
let mut upsampled = i as f32 * downsample_ratio;
|
||||||
|
if upsampled > (data.len()-1) as f32 {
|
||||||
|
upsampled = (data.len()-1) as f32
|
||||||
|
}
|
||||||
|
downsampled_data.push(data[upsampled as usize]);
|
||||||
|
}
|
||||||
|
match send.try_send(downsampled_data) {
|
||||||
|
Ok(_) => (),
|
||||||
|
Err(msg) => eprintln!("failed to ingest audio: {}", msg),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
move |err| {
|
||||||
|
eprintln!("input error: {}", err)
|
||||||
|
},
|
||||||
|
None,
|
||||||
|
).unwrap();
|
||||||
|
stream.play().unwrap();
|
||||||
|
|
||||||
|
eprintln!("listening on {}", device.name().unwrap());
|
||||||
|
let mut signals = Signals::new(&[SIGINT]).unwrap();
|
||||||
|
for sig in signals.forever() {
|
||||||
|
eprintln!("sig {}", sig);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
stream.pause().unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><title>List of all items in this crate</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-fa3bb1812debf86c.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rust_whisper_lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.74.0 (79e9716c9 2023-11-13)" data-channel="1.74.0" data-search-js="search-8be46b629f5f14a8.js" data-settings-js="settings-74424d7eec62a23e.js" ><script src="../static.files/storage-fec3eaa3851e447d.js"></script><script defer src="../static.files/main-c5bd66d33317d69f.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-5d8b3c7633ad77ba.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../rust_whisper_lib/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a></nav><nav class="sidebar"><a class="logo-container" href="../rust_whisper_lib/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">Crate rust_whisper_lib</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.AWhispered.html">AWhispered</a></li><li><a href="struct.Flags.html">Flags</a></li><li><a href="struct.Whispered.html">Whispered</a></li></ul><h3 id="functions">Functions</h3><ul class="all-items"><li><a href="fn.main.html">main</a></li></ul></section></div></main></body></html>
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `main` fn in crate `rust_whisper_lib`."><title>main in rust_whisper_lib - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-fa3bb1812debf86c.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rust_whisper_lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.74.0 (79e9716c9 2023-11-13)" data-channel="1.74.0" data-search-js="search-8be46b629f5f14a8.js" data-settings-js="settings-74424d7eec62a23e.js" ><script src="../static.files/storage-fec3eaa3851e447d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-c5bd66d33317d69f.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-5d8b3c7633ad77ba.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../rust_whisper_lib/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a></nav><nav class="sidebar"><a class="logo-container" href="../rust_whisper_lib/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><div class="sidebar-elems"><h2><a href="index.html">In rust_whisper_lib</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">rust_whisper_lib</a>::<wbr><a class="fn" href="#">main</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../src/rust_whisper_lib/lib.rs.html#33-90">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn main<F>(flags: <a class="struct" href="struct.Flags.html" title="struct rust_whisper_lib::Flags">Flags</a>, handler_fn: F)<span class="where fmt-newline">where
|
||||||
|
F: <a class="trait" href="https://doc.rust-lang.org/1.74.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="enum" href="https://doc.rust-lang.org/1.74.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Whispered.html" title="struct rust_whisper_lib::Whispered">Whispered</a>, <a class="struct" href="https://doc.rust-lang.org/1.74.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>) + <a class="trait" href="https://doc.rust-lang.org/1.74.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,</span></code></pre></section></div></main></body></html>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `rust_whisper_lib` crate."><title>rust_whisper_lib - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-fa3bb1812debf86c.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rust_whisper_lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.74.0 (79e9716c9 2023-11-13)" data-channel="1.74.0" data-search-js="search-8be46b629f5f14a8.js" data-settings-js="settings-74424d7eec62a23e.js" ><script src="../static.files/storage-fec3eaa3851e447d.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-c5bd66d33317d69f.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-5d8b3c7633ad77ba.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../rust_whisper_lib/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a></nav><nav class="sidebar"><a class="logo-container" href="../rust_whisper_lib/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">Crate rust_whisper_lib</a></h2><div class="sidebar-elems"><ul class="block"><li class="version">Version 0.1.0</li><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Crate <a class="mod" href="#">rust_whisper_lib</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../src/rust_whisper_lib/lib.rs.html#1-363">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.AWhispered.html" title="struct rust_whisper_lib::AWhispered">AWhispered</a></div></li><li><div class="item-name"><a class="struct" href="struct.Flags.html" title="struct rust_whisper_lib::Flags">Flags</a></div></li><li><div class="item-name"><a class="struct" href="struct.Whispered.html" title="struct rust_whisper_lib::Whispered">Whispered</a></div></li></ul><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.main.html" title="fn rust_whisper_lib::main">main</a></div></li></ul></section></div></main></body></html>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
window.SIDEBAR_ITEMS = {"fn":["main"],"struct":["AWhispered","Flags","Whispered"]};
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue