Merge commit '1b74e0d'
This commit is contained in:
@@ -6,7 +6,8 @@ env.allowLocalModels = false;
|
||||
let progressCallback = (progress) => {
|
||||
const status = document.getElementById('status');
|
||||
if (progress.status === 'progress') {
|
||||
status.textContent = `Downloading model... ${progress.file}`;
|
||||
const pct = progress.progress != null ? ` ${Math.round(progress.progress)}%` : '';
|
||||
status.textContent = `Downloading model... ${progress.file}${pct}`;
|
||||
} else if (progress.status === 'done') {
|
||||
status.textContent = 'Model loaded';
|
||||
}
|
||||
@@ -28,7 +29,7 @@ let recognition;
|
||||
let transcriber = null;
|
||||
let currentModel = null;
|
||||
|
||||
const getModelForLanguage = () => 'Xenova/whisper-small';
|
||||
const getModelForLanguage = (_lang) => 'Xenova/whisper-small';
|
||||
|
||||
const bufferToWav = (buffer, sampleRate = 16000) => {
|
||||
const numOfChan = 1;
|
||||
@@ -172,7 +173,12 @@ recordBtn.addEventListener('click', async () => {
|
||||
try {
|
||||
await navigator.mediaDevices.getUserMedia({ audio: true });
|
||||
|
||||
recognition = new webkitSpeechRecognition();
|
||||
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
||||
if (!SpeechRecognition) {
|
||||
status.textContent = 'Speech recognition not supported in this browser';
|
||||
return;
|
||||
}
|
||||
recognition = new SpeechRecognition();
|
||||
recognition.continuous = true;
|
||||
recognition.interimResults = true;
|
||||
recognition.lang = languageSelect.value;
|
||||
|
||||
Reference in New Issue
Block a user