<form id='result2'></form>
<script>
  fetch('/getAudio', {method: 'POST'})
    .then(response => response.json())
    .then(response => document.getElementById('result2').innerHTML = response['Rescoring_result'])
    .catch(error => console.error(error))
</script>
<h2>修复说明</h2>
<ol>
<li>fetch API 返回的是一个 Promise 对象,需要在 then 方法中处理返回的 response 对象。</li>
<li>response 对象可以通过 json() 方法将响应体解析成 JSON 格式的对象。</li>
<li>解析出来的 response 对象才包含字典格式的 Rescoring_result 属性,需要在 then 方法中进一步处理。</li>
</ol>
使用 fetch API 解析 JSON response 并提取 Rescoring_result 属性

原文地址: https://www.cveoy.top/t/topic/lARb 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录