Skip to content

Commit

Permalink
Merge pull request huggingface#31 from xenova/whisper-timestamps
Browse files Browse the repository at this point in the history
Add support for timestamped speech-to-text (w/ whisper)
  • Loading branch information
xenova committed Mar 19, 2023
2 parents 4ad2581 + ba9ee82 commit f10106a
Show file tree
Hide file tree
Showing 12 changed files with 1,033 additions and 184 deletions.
8 changes: 4 additions & 4 deletions assets/js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ async function speech_to_text(data) {
})

return await pipeline(data.audio, {
// Choose good defaults for the demo
chunk_length_s: 30,
stride_length_s: 5,

...data.generation,
callback_function: function (beams) {
const decodedText = pipeline.tokenizer.decode(beams[0].output_token_ids, {
Expand All @@ -322,10 +326,6 @@ async function speech_to_text(data) {
data: decodedText.trim()
});
}
}, {
// Choose good defaults for the demo
chunk_length_s: 30,
stride_length_s: 5,
})
}

Expand Down
Loading

0 comments on commit f10106a

Please sign in to comment.