atlury commited on
Commit
6a0d3d7
·
verified ·
1 Parent(s): c379827

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +17 -4
index.html CHANGED
@@ -176,6 +176,10 @@
176
  import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
177
 
178
  env.localModelPath = './models';
 
 
 
 
179
 
180
  const conversationDiv = document.getElementById('conversation');
181
  const startButton = document.getElementById('startButton');
@@ -223,10 +227,17 @@
223
 
224
  async function initializePipelines() {
225
  try {
226
- sttPipeline = await pipeline('automatic-speech-recognition', 'Xenova/whisper-tiny.en');
227
- ttsPipeline = await pipeline('text-to-speech', 'Xenova/mms-tts-eng', {
228
- quantized: false,
229
- });
 
 
 
 
 
 
 
230
  addLog('System: Voice Chat Bot initialized. Click "Begin Call" to start.');
231
  startButton.disabled = false;
232
  loadingDiv.style.display = 'none';
@@ -358,6 +369,8 @@
358
  source.connect(analyser);
359
 
360
  myvad = await vad.MicVAD.new({
 
 
361
  onSpeechStart: () => {
362
  addLog('--- vad: speech start');
363
  updateVisualizer();
 
176
  import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
177
 
178
  env.localModelPath = './models';
179
+ //BELOW 3 statements added by RAHUL
180
+ env.env.backends = ['wasm'];
181
+ env.wasm.simd = true; // Enable SIMD if available
182
+ env.numThreads = navigator.hardwareConcurrency || 4; // Use available CPU cores
183
 
184
  const conversationDiv = document.getElementById('conversation');
185
  const startButton = document.getElementById('startButton');
 
227
 
228
  async function initializePipelines() {
229
  try {
230
+
231
+ //sttPipeline = await pipeline('automatic-speech-recognition', 'Xenova/whisper-tiny.en', { quantized: true }); // added , { quantized: true }
232
+ //ttsPipeline = await pipeline('text-to-speech', 'Xenova/mms-tts-eng', {
233
+ // quantized: true, //changed to true - RAHUL ATLURY
234
+ //});
235
+
236
+ [sttPipeline, ttsPipeline] = await Promise.all([
237
+ pipeline('automatic-speech-recognition', 'Xenova/whisper-tiny.en', { quantized: true }),
238
+ pipeline('text-to-speech', 'Xenova/mms-tts-eng', { quantized: true })
239
+ ]);
240
+
241
  addLog('System: Voice Chat Bot initialized. Click "Begin Call" to start.');
242
  startButton.disabled = false;
243
  loadingDiv.style.display = 'none';
 
369
  source.connect(analyser);
370
 
371
  myvad = await vad.MicVAD.new({
372
+ noiseSuppression: true, ///Added by RAHUL Atlury
373
+ aggressiveness: 3, // Higher value for more aggressive detection Added by RAHUL ATLURY
374
  onSpeechStart: () => {
375
  addLog('--- vad: speech start');
376
  updateVisualizer();