目标:
可以在本地计算机上运行tensorflow.js毒性分类器演示。
问题:
基于"https://github.com/tensorflow/tfjs/issues/149“指令
“你不能在浏览器中调用imports,因为浏览器不支持这样的导入。与其从‘@tensorflow/ tfjs’以tf *的形式加载tfjs,不如通过搜索节点模块并使用webpack之类的工具加载它,或者使用这里提到的准备好的cdn加载它。”
我从‘@tensorflow/tfjs’中删除了"import * as tf“,并开始使用
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest"></script>但是我仍然检索到一条错误消息
ReferenceError:毒性在index.js:95的预测(index.js:71)中没有定义
我需要修复哪些部分才能让一切正常工作?
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看到代码问题,我使用了来自“index.html”的文件https://github.com/tensorflow/tfjs-models/tree/master/toxicity/demo和index.js,并在我的本地计算机中使用过。


发布于 2019-10-20 16:59:38
https://stackblitz.com/edit/typescript-tkmkho
将代码作为stackblitz中的类型记录应用。
https://stackoverflow.com/questions/58470824
复制相似问题