【发布时间】:2020-02-12 11:40:46
【问题描述】:
我正在尝试从谷歌云中读取 mp3/wav 数据并尝试实施音频 diarization 技术。问题是我无法读取 google api 在可变响应中传递的结果。
下面是我的python代码
speech_file = r'gs://pp003231/a4a.wav'
config = speech.types.RecognitionConfig(
encoding=speech.enums.RecognitionConfig.AudioEncoding.LINEAR16,
language_code='en-US',
enable_speaker_diarization=True,
diarization_speaker_count=2)
audio = speech.types.RecognitionAudio(uri=speech_file)
response = client.long_running_recognize(config, audio)
print response
result = response.results[-1]
print result
控制台上显示的输出是 回溯(最近一次通话最后): 文件“a1.py”,第 131 行,在 打印 response.results AttributeError:“操作”对象没有属性“结果”
您能否就我做错的事情分享您的专家建议? 感谢您的帮助。
【问题讨论】:
标签: python python-2.7 google-cloud-speech