speech_transcribe_async.yaml 1.2 KB

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