|
import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]'; |
|
|
|
|
|
env.allowLocalModels = false; |
|
|
|
|
|
const status = document.getElementById('status'); |
|
const msg = document.getElementById('message'); |
|
const checkMessage = document.getElementById('checkMessage'); |
|
|
|
status.textContent = 'Loading model...'; |
|
const classifier = await pipeline('text-classification', 'bajrangCoder/roberta_spam_onnx_quantised'); |
|
|
|
status.textContent = 'Ready'; |
|
|
|
checkMessage.onclick = async function (){ |
|
status.textContent = 'Analysing...'; |
|
const output = await classifier(msg.value); |
|
status.textContent = JSON.stringify(output); |
|
} |
|
|