From 1ab7bd4563d0ca2a1341b5a55d1de4cd7a496a53 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Mon, 22 Mar 2021 18:25:38 -0400 Subject: [PATCH] Fix --- util/Util.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/util/Util.js b/util/Util.js index b4ef88a8..3e76d2fc 100644 --- a/util/Util.js +++ b/util/Util.js @@ -1,6 +1,5 @@ const crypto = require('crypto'); const tf = require('@tensorflow/tfjs-node'); -const sizeOf = require('buffer-image-size'); const { decode: decodeHTML } = require('html-entities'); const { stripIndents } = require('common-tags'); const { URL } = require('url'); @@ -219,13 +218,7 @@ module.exports = class Util { } static async isImageNSFW(model, image, bool = true) { - const dimensions = sizeOf(image); - const data = { - data: image, - width: dimensions.width, - height: dimensions.height - }; - const img = await tf.node.decodeImage(data, 3); + const img = await tf.node.decodeImage(image, 3); const predictions = await model.classify(img, 1); img.dispose(); return bool ? predictions[0] !== 'Neutral' && predictions[0] !== 'Drawing' : predictions[0];