Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform 谷歌云的演讲从未给出回应_Google Cloud Platform_Google Speech Api - Fatal编程技术网

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