Update jspp.js
This commit is contained in:
parent
3dffa7e412
commit
24acc782d3
1 changed files with 2 additions and 3 deletions
5
jspp.js
5
jspp.js
|
@ -18,18 +18,17 @@ 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 toxic = false
|
|
||||||
|
|
||||||
toxicity.load(threshold).then(model => {
|
toxicity.load(threshold).then(model => {
|
||||||
model.classify(sentences).then(predictions => {
|
model.classify(sentences).then(predictions => {
|
||||||
predictions.forEach(classified => {
|
predictions.forEach(classified => {
|
||||||
if (classified.label == "toxicity") {
|
if (classified.label == "toxicity") {
|
||||||
toxic = classified.results.match
|
var toxic = classified.results.match
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return toxic
|
return toxic
|
||||||
}
|
}
|
||||||
|
|
||||||
async asyncSleep(ms) {
|
async asyncSleep(ms) {
|
||||||
|
|
Loading…
Reference in a new issue