【发布时间】:2020-11-04 17:59:34
【问题描述】:
我正在尝试转录我的电脑和 Google 存储桶上都有的德语播客。我使用this tutorial 作为参考。
这是我的代码:
frame_rate, channels = frame_rate_channel('pod.wav')
gcs_uri = 'gs://callsaudiofiles21/pod.wav'
client = speech.SpeechClient()
audio = types.RecognitionAudio(uri=gcs_uri)
config = types.RecognitionConfig(
encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=frame_rate,
language_code='de-DE')
transcript = ''
operation = client.long_running_recognize(config, audio)
response = operation.result(timeout=10000)
for result in response.results:
transcript += result.alternatives[0].transcript
但它停在operation 行,输出TypeError: long_running_recognize() takes from 1 to 2 positional arguments but 3 were given。该教程是一年前的,所以从那以后 API 中肯定发生了一些变化。不过我不确定要修改什么。
【问题讨论】:
标签: python api google-cloud-platform speech-recognition speech-to-text