启用在本地计算机中使用 Tensorflow JS

Enable to use Tensorflow JS in the local computer

目标:
在本地计算机中启用 运行 tensorflow.js 毒性分类器演示。

问题:
基于指令“https://github.com/tensorflow/tfjs/issues/149

"You cannot call imports in a browser since browsers don't support such imports. Instead of loading tfjs as import * as tf from '@tensorflow/tfjs';, you need to import the library by either transpiring the node module and load it as a bundle using tools like webpack or load it using ready-to-use cdn mentioned here."

我已删除 "import * as tf from '@tensorflow/tfjs';" 并开始使用

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest"></script>

但我仍然检索到一条错误消息

“未捕获(承诺)ReferenceError:未定义毒性 在预测 (index.js:71) 在 index.js:95"

我需要修复哪一部分才能正常工作?
https://jsbin.com/wiqigayoqu/edit?html,js,console,output

谢谢!

信息:
*我是 Tensorflow.js
的新人 *原始源代码位于“https://github.com/tensorflow/tfjs-models/tree/master/toxicity/demo
* https://github.com/tensorflow/tfjs-models/tree/master/toxicity
*我不知道你是否能够看到jsbin的代码问题,我已经使用了“https://github.com/tensorflow/tfjs-models/tree/master/toxicity/demo”中的文件index.html和index.js,并在我的本地计算机上使用了它。

https://stackblitz.com/edit/typescript-tkmkho

在 stackblitz 中将代码作为打字稿应用。