deno run toxicity.ts
import tfjs from "npm:tensorflow";
import toxicity from "npm:tensorflow-models/toxicity";
toxicity.load(threshold).then((model: any) =>
{
});
error: Unable to load /Users/username/Library/Caches/deno/npm/registry.npmjs.org/tensorflow-models/0.0.1/toxicity imported from file:///Users/username/test/toxicity.ts
Caused by:
Is a directory (os error 21)
Got it working :
import tfjs from "npm:@tensorflow/tfjs@4.2.0";
import * as toxicity from "npm:@tensorflow-models/toxicity@1.2.2";
For error: npm package '@types/node-fetch' does not exist
Need this in tsconfig.json because apparently ‘ESM support in ts-node is currently experimental.’ (node.js - Can't import node-fetch into Typescript - Stack Overflow)
{
"compilerOptions": {
"module": "esnext"
}
}