m2iceman commited on
Commit
b13ee14
·
verified ·
1 Parent(s): 2cf4acc

Update mega-asr.js

Browse files
Files changed (1) hide show
  1. mega-asr.js +2 -2
mega-asr.js CHANGED
@@ -3,7 +3,7 @@
3
  // the tokenizer + Whisper mel features via @huggingface/transformers,
4
  // and runs the encode/prefill/step pipeline on the user's device.
5
 
6
- import { AutoTokenizer, AutoProcessor, RawAudio } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.5.2/dist/transformers.min.js";
7
  import * as ort from "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.0/dist/ort.webgpu.bundle.min.mjs";
8
 
9
  ort.env.wasm.numThreads = navigator.hardwareConcurrency || 4;
@@ -287,7 +287,7 @@ async function audioToMel(file) {
287
  pcm = tmp;
288
  }
289
  // Run through transformers.js WhisperFeatureExtractor (via the loaded processor)
290
- const feat = await state.processor(new RawAudio(pcm, 16000));
291
  // feat.input_features: Tensor[1, 128, T]
292
  return { mel: feat.input_features.data, dims: feat.input_features.dims };
293
  }
 
3
  // the tokenizer + Whisper mel features via @huggingface/transformers,
4
  // and runs the encode/prefill/step pipeline on the user's device.
5
 
6
+ import { AutoTokenizer, AutoProcessor } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.5.2/dist/transformers.min.js";
7
  import * as ort from "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.0/dist/ort.webgpu.bundle.min.mjs";
8
 
9
  ort.env.wasm.numThreads = navigator.hardwareConcurrency || 4;
 
287
  pcm = tmp;
288
  }
289
  // Run through transformers.js WhisperFeatureExtractor (via the loaded processor)
290
+ const feat = await state.processor(pcm);
291
  // feat.input_features: Tensor[1, 128, T]
292
  return { mel: feat.input_features.data, dims: feat.input_features.dims };
293
  }