mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 06:10:49 +02:00
Fix
This commit is contained in:
@@ -28,7 +28,8 @@ module.exports = class NsfwCommand extends Command {
|
||||
try {
|
||||
const { body } = await request.get(image);
|
||||
const prediction = await isImageNSFW(this.client.nsfwModel, body, false);
|
||||
return msg.reply(`I'm **${prediction.probability}%** sure this image is: **${prediction.className}**.`);
|
||||
const prob = Math.round(prediction.probability * 100);
|
||||
return msg.reply(`I'm **${prob}%** sure this image is: **${prediction.className}**.`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
|
||||
+1
-1
@@ -221,7 +221,7 @@ module.exports = class Util {
|
||||
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];
|
||||
return bool ? predictions[0].className !== 'Neutral' && predictions[0].className !== 'Drawing' : predictions[0];
|
||||
}
|
||||
|
||||
static async reactIfAble(msg, user, emoji, fallbackEmoji) {
|
||||
|
||||
Reference in New Issue
Block a user