Update jspp.js

This commit is contained in:
Sam Sneed 2024-05-31 20:34:37 +00:00 committed by GitHub
parent cd679dba4e
commit 231de7d196
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

13
jspp.js
View file

@ -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)
} }
} }