Remove libarchive, implement untar manually. Use vosk-browser models
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="https://cdn.jsdelivr.net/gh/msqr1/Vosklet@1.0.3/examples/Vosklet.min.js" async defer></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/msqr1/Vosklet@1.0.4/examples/Vosklet.min.js" async defer></script>
|
||||
<script>
|
||||
async function start() {
|
||||
// Make sure sample rate matches that in the training data
|
||||
let ctx = new AudioContext({sampleRate : 16000})
|
||||
let module = await loadVosklet()
|
||||
let model = await module.createModel("https://raw.githubusercontent.com/msqr1/Vosklet/main/examples/en-model.tgz","model","ID")
|
||||
let model = await module.createModel("https://raw.githubusercontent.com/ccoreilly/vosk-browser/master/examples/react/public/models/vosk-model-small-en-us-0.15.tar.gz","model","ID")
|
||||
let recognizer = await module.createRecognizer(model, 16000)
|
||||
|
||||
// Listen for result and partial result
|
||||
recognizer.addEventListener("result", ev => {
|
||||
console.log("Result: ", ev.detail)
|
||||
})
|
||||
recognizer.addEventListener("partialResult", ev => {
|
||||
console.log("Partial result: ", ev.detail)
|
||||
})
|
||||
|
||||
// Fetch, decode, and recognize .wav
|
||||
let wav = await fetch("https://raw.githubusercontent.com/msqr1/Vosklet/main/examples/example.wav")
|
||||
let audioBuf = await ctx.decodeAudioData(await wav.arrayBuffer())
|
||||
|
||||
Reference in New Issue
Block a user