Created
September 29, 2023 09:31
-
-
Save kivlor/1598484f621c6dadd5fcf0126fc46dd6 to your computer and use it in GitHub Desktop.
deno + transformers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
env, | |
pipeline, | |
} from "https://cdn.jsdelivr.net/npm/@xenova/transformers"; | |
env.backends.onnx.wasm.numThreads = 1; | |
const classifier = await pipeline( | |
"text-classification", | |
"Xenova/distilbert-base-uncased-finetuned-sst-2-english", | |
); | |
const input = [ | |
"I love Transformers.js", | |
"I hate Transformers.js", | |
"I don't mind Transformers.js", | |
]; | |
const result = await classifier(input); | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment