Google cloud platform 谷歌云的演讲从未给出回应
我使用的谷歌云语音如下所示:Google cloud platform 谷歌云的演讲从未给出回应,google-cloud-platform,google-speech-api,Google Cloud Platform,Google Speech Api,我使用的谷歌云语音如下所示: def transcribe_file_with_word_time_offsets(speech_files): """Transcribe the given audio file synchronously and output the word time offsets.""" from google.cloud import speech from google.cloud.speech import enums f
def transcribe_file_with_word_time_offsets(speech_files):
"""Transcribe the given audio file synchronously and output the word time
offsets."""
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
client = speech.SpeechClient()
files = sorted(glob.glob(speech_files))
starting_number = 0
filenames_and_text = []
for f in files:
with io.open(f, 'rb') as audio_file:
content = audio_file.read()
audio = speech.types.RecognitionAudio(content=content)
config = speech.types.RecognitionConfig(
encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=22050,
language_code='en-UK')
response = client.recognize(config , audio)
这不会导致错误,只要在到达
response=client.recognize(config,audio)
行时永久挂起即可。我以前使用过这个脚本,没有任何问题,但现在它已经很长时间不起作用了。类似地运行python transcribe.py audio_file.wav
和transcribe.py
从just hangs fore类似地运行python transcribe.py audio_file.wav
和transcribe.py
从just hangs fore