【发布时间】:2023-01-20 02:24:42
【问题描述】:
我写的代码没有给出我想要的答案。
from wit import Wit
client = Wit("XXXYYYZZZ")
with open('sa.mp3', 'rb') as f:
resp = client.speech(f, {'Content-Type': 'audio/wav'})
print('Yay, got Wit.ai response: ' + str(resp))`
代码给了我“耶,得到了 Wit.ai 响应:{'entities': {}, 'intents': [], 'text': '', 'traits': {}}”
为什么?
【问题讨论】:
-
sa.mp3不是 WAV 文件。您需要使用正确的格式标识。 -
尝试 PCM 音频文件,因为这是 Wit 期望的默认格式。