Update jspp.js
This commit is contained in:
parent
0a6c39513f
commit
9fc1cc7c1f
1 changed files with 7 additions and 7 deletions
12
jspp.js
12
jspp.js
|
@ -14,6 +14,7 @@ class JSPlusPlus {
|
||||||
isToxic(sentences) {
|
isToxic(sentences) {
|
||||||
// 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.
|
||||||
|
const help = new JSPlusPlus.General.Helpers
|
||||||
help.require("https://cdn.jsdelivr.net/npm/@tensorflow/tfjs")
|
help.require("https://cdn.jsdelivr.net/npm/@tensorflow/tfjs")
|
||||||
help.require("https://cdn.jsdelivr.net/npm/@tensorflow-models/toxicity")
|
help.require("https://cdn.jsdelivr.net/npm/@tensorflow-models/toxicity")
|
||||||
let threshold = 0.9;
|
let threshold = 0.9;
|
||||||
|
@ -450,10 +451,12 @@ class JSPlusPlus {
|
||||||
}
|
}
|
||||||
|
|
||||||
createDiv(elementID) {
|
createDiv(elementID) {
|
||||||
|
const htmlFront = new JSPlusPlus.HTMLFrontend
|
||||||
htmlFront.createElement("div", elementID);
|
htmlFront.createElement("div", elementID);
|
||||||
}
|
}
|
||||||
|
|
||||||
createParagraph(elementID, text) {
|
createParagraph(elementID, text) {
|
||||||
|
const htmlFront = new JSPlusPlus.HTMLFrontend;
|
||||||
let elem = htmlFront.createElement("p", elementID);
|
let elem = htmlFront.createElement("p", elementID);
|
||||||
elem.innerText = `${text}`
|
elem.innerText = `${text}`
|
||||||
return elem
|
return elem
|
||||||
|
@ -507,7 +510,7 @@ class JSPlusPlus {
|
||||||
}
|
}
|
||||||
|
|
||||||
createButton(elementID, text, attributes = {}) {
|
createButton(elementID, text, attributes = {}) {
|
||||||
let elem = htmlFront.createElement("button", elementID);
|
const htmlFront = new JSPlusPlus.HTMLFrontend; let elem = htmlFront.createElement("button", elementID);
|
||||||
elem.innerText = `${text}`
|
elem.innerText = `${text}`
|
||||||
for (const [name, value] of Object.entries(attributes)) {
|
for (const [name, value] of Object.entries(attributes)) {
|
||||||
elem.setAttribute(name, value);
|
elem.setAttribute(name, value);
|
||||||
|
@ -539,6 +542,7 @@ class JSPlusPlus {
|
||||||
}
|
}
|
||||||
|
|
||||||
createImage(elementID, src) {
|
createImage(elementID, src) {
|
||||||
|
const htmlFront = new JSPlusPlus.HTMLFrontend;
|
||||||
return htmlFront.createElement("img", elementID, { src: src });
|
return htmlFront.createElement("img", elementID, { src: src });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -750,13 +754,9 @@ class JSPlusPlus {
|
||||||
|
|
||||||
|
|
||||||
initGun(relays = []) {
|
initGun(relays = []) {
|
||||||
|
const help = new JSPlusPlus.General.Helpers
|
||||||
help.require("https://cdn.jsdelivr.net/npm/gun/gun.js")
|
help.require("https://cdn.jsdelivr.net/npm/gun/gun.js")
|
||||||
return Gun(relays)
|
return Gun(relays)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const pp = new JSPlusPlus
|
|
||||||
const help = new JSPLusPlus.Helpers
|
|
||||||
const htmlFront = new JSPlusPlus.HTMLFrontend
|
|
||||||
|
|
Loading…
Reference in a new issue