Update jspp.js

This commit is contained in:
Sam Sneed 2024-05-31 23:14:40 +00:00 committed by GitHub
parent cc9a7d6515
commit 4aa90e68db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

11
jspp.js
View file

@ -18,12 +18,15 @@ 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;
return toxicity.load(threshold).then(model => { let t = await toxicity.load(threshold).then(model => {
return model.classify(sentences).then(predictions => { let m = await model.classify(sentences).then(predictions => {
console.log(predictions) let p = await predictions
return predictions console.log(p)
return p
}); });
return m
}); });
return t
} }
async asyncSleep(ms) { async asyncSleep(ms) {