worker fix?
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/ai-utils",
|
"name": "@ztimson/ai-utils",
|
||||||
"version": "0.6.7",
|
"version": "0.6.7-rc.1",
|
||||||
"description": "AI Utility library",
|
"description": "AI Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ function combineSpeakerTranscript(chunks: any[], speakers: any[]): string {
|
|||||||
|
|
||||||
parentPort?.on('message', async ({ file, speaker, model, modelDir }) => {
|
parentPort?.on('message', async ({ file, speaker, model, modelDir }) => {
|
||||||
try {
|
try {
|
||||||
|
console.log('worker', file);
|
||||||
if(!whisperPipeline) whisperPipeline = await pipeline('automatic-speech-recognition', `Xenova/${model}`, {cache_dir: modelDir, quantized: true});
|
if(!whisperPipeline) whisperPipeline = await pipeline('automatic-speech-recognition', `Xenova/${model}`, {cache_dir: modelDir, quantized: true});
|
||||||
|
|
||||||
// Prepare audio file (convert to mono channel wave)
|
// Prepare audio file (convert to mono channel wave)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export class Audio {
|
|||||||
constructor(private ai: Ai) {}
|
constructor(private ai: Ai) {}
|
||||||
|
|
||||||
asr(file: string, options: { model?: string; speaker?: boolean } = {}): AbortablePromise<string | null> {
|
asr(file: string, options: { model?: string; speaker?: boolean } = {}): AbortablePromise<string | null> {
|
||||||
|
console.log('audio', file);
|
||||||
const { model = this.ai.options.asr || 'whisper-base', speaker = false } = options;
|
const { model = this.ai.options.asr || 'whisper-base', speaker = false } = options;
|
||||||
let aborted = false;
|
let aborted = false;
|
||||||
const abort = () => { aborted = true; };
|
const abort = () => { aborted = true; };
|
||||||
|
|||||||
Reference in New Issue
Block a user