I am using Google Cloud Speech like the following:

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)

This won't result in an error, just hang forever when it gets to the response = client.recognize(config , audio) line. I had used this exact script before without issues but now it hasn't worked for a long time.

0 Answers