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