218bc5980ee488f5ac2ddfb9d3c67b8ba5b3fd69,speech/cloud-client/transcribe.py,,transcribe_gcs,#Any#,49

Before Change


    from google.cloud import speech
    speech_client = speech.Client()

    audio_sample = speech_client.sample(
        content=None,
        source_uri=gcs_uri,
        encoding="FLAC",
        sample_rate_hertz=16000)

    alternatives = audio_sample.recognize("en-US")
    for alternative in alternatives:
        print("Transcript: {}".format(alternative.transcript))

After Change


    client = speech.SpeechClient()

    // [START migration_audio_config_gcs]
    audio = types.RecognitionAudio(uri=gcs_uri)
    config = types.RecognitionConfig(
        encoding=enums.RecognitionConfig.AudioEncoding.FLAC,
        sample_rate_hertz=16000,
        language_code="en-US")
    // [END migration_audio_config_gcs]

    response = client.recognize(config, audio)
    alternatives = response.results[0].alternatives

    for alternative in alternatives:
        print("Transcript: {}".format(alternative.transcript))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 17

Instances


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 218bc5980ee488f5ac2ddfb9d3c67b8ba5b3fd69
Time: 2017-07-14
Author: dizcology@hotmail.com
File Name: speech/cloud-client/transcribe.py
Class Name:
Method Name: transcribe_gcs


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 218bc5980ee488f5ac2ddfb9d3c67b8ba5b3fd69
Time: 2017-07-14
Author: dizcology@hotmail.com
File Name: speech/cloud-client/transcribe.py
Class Name:
Method Name: transcribe_gcs


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 218bc5980ee488f5ac2ddfb9d3c67b8ba5b3fd69
Time: 2017-07-14
Author: dizcology@hotmail.com
File Name: speech/cloud-client/transcribe.py
Class Name:
Method Name: transcribe_file


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 218bc5980ee488f5ac2ddfb9d3c67b8ba5b3fd69
Time: 2017-07-14
Author: dizcology@hotmail.com
File Name: speech/cloud-client/quickstart.py
Class Name:
Method Name: run_quickstart