File size: 474 Bytes
b38c8eb 441f679 b38c8eb |
1 2 3 4 5 6 7 8 9 10 11 12 |
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() |