From a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 19 Sep 2022 03:11:50 +0900 Subject: test --- packages/backend/src/core/AiService.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'packages/backend/src/core/AiService.ts') diff --git a/packages/backend/src/core/AiService.ts b/packages/backend/src/core/AiService.ts index 1cfc3382a9..e6102a1b91 100644 --- a/packages/backend/src/core/AiService.ts +++ b/packages/backend/src/core/AiService.ts @@ -15,7 +15,7 @@ let isSupportedCpu: undefined | boolean = undefined; @Injectable() export class AiService { - #model: nsfw.NSFWJS; + private model: nsfw.NSFWJS; constructor( @Inject(DI.config) @@ -26,7 +26,7 @@ export class AiService { public async detectSensitive(path: string): Promise { try { if (isSupportedCpu === undefined) { - const cpuFlags = await this.#getCpuFlags(); + const cpuFlags = await this.getCpuFlags(); isSupportedCpu = REQUIRED_CPU_FLAGS.every(required => cpuFlags.includes(required)); } @@ -37,12 +37,12 @@ export class AiService { const tf = await import('@tensorflow/tfjs-node'); - if (this.#model == null) this.#model = await nsfw.load(`file://${_dirname}/../../nsfw-model/`, { size: 299 }); + if (this.model == null) this.model = await nsfw.load(`file://${_dirname}/../../nsfw-model/`, { size: 299 }); const buffer = await fs.promises.readFile(path); const image = await tf.node.decodeImage(buffer, 3) as any; try { - const predictions = await this.#model.classify(image); + const predictions = await this.model.classify(image); return predictions; } finally { image.dispose(); @@ -53,7 +53,7 @@ export class AiService { } } - async #getCpuFlags(): Promise { + private async getCpuFlags(): Promise { const str = await si.cpuFlags(); return str.split(/\s+/); } -- cgit v1.2.3-freya