小编Jia*_* Li的帖子

未捕获(承诺)类型错误:无法读取 null 的属性“长度”

在此处输入图片说明

我正在关注TensorFlow.js - 使用迁移学习教程进行音频识别。当我按“火车”按钮调用 train() 函数时,错误如上。是我还是教程中有错误?

(我确实按照指南一步一步地进行了……并在最新版本的 chrome 中使用本地主机对其进行了测试)

第一个片段来自 index.js,第二个片段来自 index.html。

let recognizer;

function predictWord() {
 // Array of words that the recognizer is trained to recognize.
 const words = recognizer.wordLabels();
 recognizer.listen(({scores}) => {
   // Turn scores into a list of (score,word) pairs.
   scores = Array.from(scores).map((s, i) => ({score: s, word: words[i]}));
   // Find the most probable word.
   scores.sort((s1, s2) => s2.score - s1.score);
   document.querySelector('#console').textContent = scores[0].word;
 }, {probabilityThreshold: 0.75});
}

async function app() {
 recognizer …
Run Code Online (Sandbox Code Playgroud)

html javascript tensorflow.js

3
推荐指数
1
解决办法
716
查看次数

标签 统计

html ×1

javascript ×1

tensorflow.js ×1