FredZhang7's picture
upload tensorflow files
441f679
raw
history blame
474 Bytes
async function run() {
const { vitchen_toxicity_encode } = require('./toxicity-tfjs/bert-tokenizer');
const {loadSavedModel, tensor} = require('./toxicity-tfjs/node');
const model = await loadSavedModel('./bert-small-multilingual');
const input = vitchen_toxicity_encode(`What's up?`);
let t = tensor(input, [192], 'int32');
const prediction = model.predict({
input_ids: t
})['output_0'];
console.log(prediction.dataSync()[0])
}
run()