From 37b034f067024bd25702e5b96f61e4102b5e0926 Mon Sep 17 00:00:00 2001 From: Sam Sneed <163201376+sam-sneed@users.noreply.github.com> Date: Fri, 31 May 2024 22:47:24 +0000 Subject: [PATCH] Update jspp.js --- jspp.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/jspp.js b/jspp.js index 9b42bb7..c5a1c33 100644 --- a/jspp.js +++ b/jspp.js @@ -18,17 +18,15 @@ class JSPlusPlus { gen.require("https://cdn.jsdelivr.net/npm/@tensorflow/tfjs") gen.require("https://cdn.jsdelivr.net/npm/@tensorflow-models/toxicity") let threshold = 0.9; - + let toxics = [] toxicity.load(threshold).then(model => { model.classify(sentences).then(predictions => { predictions.forEach(classified => { - if (classified.label == "toxicity") { - var toxic = classified.results.match - } + toxics = classified.results.match }); }); }); - return toxic + return toxics; } async asyncSleep(ms) {