speech_transcribe_async_gcs.yaml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto
  2. schema_version: 1.2.0
  3. samples:
  4. - region_tag: speech_transcribe_async_gcs
  5. title: Transcript Audio File using Long Running Operation (Cloud Storage) (LRO)
  6. description: Transcribe long audio file from Cloud Storage using asynchronous speech recognition
  7. rpc: LongRunningRecognize
  8. service: google.cloud.speech.v1.Speech
  9. request:
  10. - field: audio.uri
  11. value: "gs://cloud-samples-data/speech/brooklyn_bridge.raw"
  12. input_parameter: storage_uri
  13. comment: URI for audio file in Cloud Storage, e.g. gs://[BUCKET]/[FILE]
  14. - field: config.sample_rate_hertz
  15. value: 16000
  16. comment: Sample rate in Hertz of the audio data sent
  17. - field: config.language_code
  18. value: "en-US"
  19. comment: The language of the supplied audio
  20. - field: config.encoding
  21. value: LINEAR16
  22. comment: |
  23. Encoding of audio data sent. This sample sets this explicitly.
  24. This field is optional for FLAC and WAV audio formats.
  25. response:
  26. - loop:
  27. variable: result
  28. collection: $resp.results
  29. body:
  30. - comment:
  31. - First alternative is the most probable result
  32. - define: alternative = result.alternatives[0]
  33. - print:
  34. - "Transcript: %s"
  35. - alternative.transcript