expose diarization support checking function
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ztimson/ai-utils",
|
||||
"version": "0.6.0",
|
||||
"version": "0.6.1",
|
||||
"description": "AI Utility library",
|
||||
"author": "Zak Timson",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -33,7 +33,7 @@ export class Audio {
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
private async isPyannoteInstalled(): Promise<boolean> {
|
||||
async canDiarization(): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
const proc = spawn('python3', ['-c', 'import pyannote.audio']);
|
||||
proc.on('close', (code: number) => resolve(code === 0));
|
||||
@@ -42,7 +42,7 @@ export class Audio {
|
||||
}
|
||||
|
||||
private async runDiarization(audioPath: string): Promise<any[]> {
|
||||
if(!await this.isPyannoteInstalled()) throw new Error('Pyannote is not installed: pip install pyannote.audio');
|
||||
if(!await this.canDiarization()) throw new Error('Pyannote is not installed: pip install pyannote.audio');
|
||||
const script = `
|
||||
import sys
|
||||
import json
|
||||
|
||||
Reference in New Issue
Block a user