def transcribe_audio()

in speech/main.py [0:0]


def transcribe_audio(source_uri):

    # Create a Speech Client object to interact with the Speech Client Library.
    client = speech.SpeechClient()

    # Create audio and config objects that you'll need to call the API.
    audio = types.RecognitionAudio(uri=source_uri)
    config = types.RecognitionConfig(
        encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
        sample_rate_hertz=16000,
        language_code='en-US')

    # Call the Speech API using the Speech Client's recognize function.
    response = client.recognize(config, audio)
    return response