Update jspp.js
This commit is contained in:
parent
cd679dba4e
commit
231de7d196
1 changed files with 7 additions and 6 deletions
13
jspp.js
13
jspp.js
|
@ -11,11 +11,11 @@ class JSPlusPlus {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isToxic(sentences) {
|
function isToxic(sentences) {
|
||||||
let gen = new JSPlusPlus.General
|
let pp = new JSPlusPlus
|
||||||
// Load the model. Users optionally pass in a threshold and an array of
|
// Load the model. Users optionally pass in a threshold and an array of
|
||||||
// labels to include.
|
// labels to include.
|
||||||
gen.require("https://cdn.jsdelivr.net/npm/@tensorflow/tfjs")
|
pp.require("https://cdn.jsdelivr.net/npm/@tensorflow/tfjs")
|
||||||
gen.require("https://cdn.jsdelivr.net/npm/@tensorflow-models/toxicity")
|
pp.require("https://cdn.jsdelivr.net/npm/@tensorflow-models/toxicity")
|
||||||
let threshold = 0.9;
|
let threshold = 0.9;
|
||||||
let toxic = false
|
let toxic = false
|
||||||
|
|
||||||
|
@ -335,7 +335,8 @@ class JSPlusPlus {
|
||||||
require(jsURI) {
|
require(jsURI) {
|
||||||
try {
|
try {
|
||||||
let req = JSPlusPlus.JSPlusPlus.readInternetText(jsURI);
|
let req = JSPlusPlus.JSPlusPlus.readInternetText(jsURI);
|
||||||
JSPlusPlus.General.exec(req);
|
let gen = new JSPlusPlus.General
|
||||||
|
gen.exec(req);
|
||||||
} catch {
|
} catch {
|
||||||
console.log(`Error! (Using Node.JS/Bun?)
|
console.log(`Error! (Using Node.JS/Bun?)
|
||||||
|
|
||||||
|
@ -749,8 +750,8 @@ class JSPlusPlus {
|
||||||
|
|
||||||
|
|
||||||
initGun(relays = []) {
|
initGun(relays = []) {
|
||||||
let gen = new JSPlusPlus.General
|
let pp = new JSPlusPlus
|
||||||
gen.require("https://cdn.jsdelivr.net/npm/gun/gun.js")
|
pp.require("https://cdn.jsdelivr.net/npm/gun/gun.js")
|
||||||
return Gun(relays)
|
return Gun(relays)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue