Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const predict = async () => {
model = await toxicity.load();
labels = model.model.outputNodes.map(d => d.split('/')[0]);
const tableWrapper = document.querySelector('#table-wrapper');
tableWrapper.insertAdjacentHTML(
'beforeend', `<div class="row">
<div class="text">TEXT</div>
${labels.map(label => {
return `<div class="label">${label.replace('_', ' ')}</div>`;
}).join('')}
</div>`);
const predictions = await classify(samples.map(d => d.text));
addPredictions(predictions);
document.querySelector('#classify-new-text')
.addEventListener('click', (e) => {