Skip to content

Commit

Permalink
add vad option to firefox extension
Browse files Browse the repository at this point in the history
  • Loading branch information
makaveli10 committed Feb 20, 2024
1 parent 99af502 commit babe5de
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Audio-Transcription-Firefox/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ function startRecording(data) {
uid: uuid,
language: data.language,
task: data.task,
model: data.modelSize
model: data.modelSize,
use_vad: data.useVad
})
);
};
Expand Down
4 changes: 4 additions & 0 deletions Audio-Transcription-Firefox/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<input type="checkbox" id="useServerCheckbox">
<label for="useServerCheckbox">Use Collabora Whisper-Live Server</label>
</div>
<div class="checkbox-container">
<input type="checkbox" id="useVadCheckbox">
<label for="useVadCheckbox">Use Voice Activity Detection</label>
</div>
<textarea id="waitTextBox" style="display: none;"></textarea>
<div class="dropdown-container">
<label for="languageDropdown">Select Language:</label>
Expand Down
16 changes: 15 additions & 1 deletion Audio-Transcription-Firefox/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ document.addEventListener("DOMContentLoaded", function() {
const stopButton = document.getElementById("stopCapture");

const useServerCheckbox = document.getElementById("useServerCheckbox");
const useVadCheckbox = document.getElementById("useVadCheckbox");
const languageDropdown = document.getElementById('languageDropdown');
const taskDropdown = document.getElementById('taskDropdown');
const modelSizeDropdown = document.getElementById('modelSizeDropdown');
Expand Down Expand Up @@ -34,6 +35,12 @@ document.addEventListener("DOMContentLoaded", function() {
}
});

browser.storage.local.get("useVadState", ({ useVadState }) => {
if (useVadState !== undefined) {
useVadCheckbox.checked = useVadState;
}
});

browser.storage.local.get("selectedLanguage", ({ selectedLanguage: storedLanguage }) => {
if (storedLanguage !== undefined) {
languageDropdown.value = storedLanguage;
Expand Down Expand Up @@ -76,7 +83,8 @@ document.addEventListener("DOMContentLoaded", function() {
port: port,
language: selectedLanguage,
task: selectedTask,
modelSize: selectedModelSize
modelSize: selectedModelSize,
useVad: useVadCheckbox.checked,
}
});
toggleCaptureButtons(true);
Expand Down Expand Up @@ -115,6 +123,7 @@ document.addEventListener("DOMContentLoaded", function() {
startButton.disabled = isCapturing;
stopButton.disabled = !isCapturing;
useServerCheckbox.disabled = isCapturing;
useVadCheckbox.disabled = isCapturing;
modelSizeDropdown.disabled = isCapturing;
languageDropdown.disabled = isCapturing;
taskDropdown.disabled = isCapturing;
Expand All @@ -128,6 +137,11 @@ document.addEventListener("DOMContentLoaded", function() {
browser.storage.local.set({ useServerState });
});

useVadCheckbox.addEventListener("change", () => {
const useVadState = useVadCheckbox.checked;
browser.storage.local.set({ useVadState });
});

languageDropdown.addEventListener('change', function() {
if (languageDropdown.value === "") {
selectedLanguage = null;
Expand Down

0 comments on commit babe5de

Please sign in to comment.