Update jspp.js
This commit is contained in:
parent
37b034f067
commit
1d9124721d
1 changed files with 3 additions and 5 deletions
8
jspp.js
8
jspp.js
|
@ -18,15 +18,13 @@ class JSPlusPlus {
|
||||||
gen.require("https://cdn.jsdelivr.net/npm/@tensorflow/tfjs")
|
gen.require("https://cdn.jsdelivr.net/npm/@tensorflow/tfjs")
|
||||||
gen.require("https://cdn.jsdelivr.net/npm/@tensorflow-models/toxicity")
|
gen.require("https://cdn.jsdelivr.net/npm/@tensorflow-models/toxicity")
|
||||||
let threshold = 0.9;
|
let threshold = 0.9;
|
||||||
let toxics = []
|
var per = ""
|
||||||
toxicity.load(threshold).then(model => {
|
toxicity.load(threshold).then(model => {
|
||||||
model.classify(sentences).then(predictions => {
|
model.classify(sentences).then(predictions => {
|
||||||
predictions.forEach(classified => {
|
console.log(predictions)
|
||||||
toxics = classified.results.match
|
per = predictions
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return toxics;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async asyncSleep(ms) {
|
async asyncSleep(ms) {
|
||||||
|
|
Loading…
Reference in a new issue