Fixed ASR
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { spawn } from 'node:child_process';
|
||||
import { pipeline } from '@xenova/transformers';
|
||||
import { AbortablePromise, Ai } from './ai.ts';
|
||||
import {spawn} from 'node:child_process';
|
||||
import {pipeline, read_audio} from '@xenova/transformers';
|
||||
import {AbortablePromise, Ai} from './ai.ts';
|
||||
|
||||
export class Audio {
|
||||
private whisperPipeline: any;
|
||||
@@ -96,7 +96,8 @@ print(json.dumps(segments))
|
||||
|
||||
// Transcript
|
||||
if(aborted) return resolve(null);
|
||||
const transcriptResult = await this.whisperPipeline(path, {return_timestamps: speaker ? 'word' : false, chunk_length_s: 30,});
|
||||
const audio = await read_audio(path, 16000);
|
||||
const transcriptResult = await this.whisperPipeline(audio, {return_timestamps: speaker ? 'word' : false, chunk_length_s: 30,});
|
||||
if(!speaker) return resolve(transcriptResult.text?.trim() || null);
|
||||
|
||||
// Speaker Diarization
|
||||
|
||||
Reference in New Issue
Block a user