Improve Whisper WASM UI example (#669)

* wip add module and js worker example

* params

* clean up, send error

* final UI with whisper webworker

* add simple instructions
This commit is contained in:
Radamés Ajna
2023-08-30 11:35:41 -07:00
committed by GitHub
parent 21e1c73892
commit 1d0bb48fae
7 changed files with 487 additions and 3 deletions

View File

@ -222,7 +222,7 @@ impl Decoder {
Ok(segments)
}
fn load(md: ModelData) -> anyhow::Result<Self> {
pub fn load(md: ModelData) -> anyhow::Result<Self> {
let device = Device::Cpu;
let tokenizer = Tokenizer::from_bytes(&md.tokenizer).map_err(anyhow::Error::msg)?;
@ -239,7 +239,7 @@ impl Decoder {
Ok(decoder)
}
fn convert_and_run(&self, wav_input: &[u8]) -> anyhow::Result<Vec<Segment>> {
pub fn convert_and_run(&self, wav_input: &[u8]) -> anyhow::Result<Vec<Segment>> {
let device = Device::Cpu;
let mut wav_input = std::io::Cursor::new(wav_input);
let (header, data) = wav::read(&mut wav_input)?;