speech_transcribe_model_selection_gcs.yaml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto
  2. schema_version: 1.2.0
  3. samples:
  4. - region_tag: speech_transcribe_model_selection_gcs
  5. title: Selecting a Transcription Model (Cloud Storage)
  6. description: |
  7. Transcribe a short audio file from Cloud Storage using a specified transcription model
  8. rpc: Recognize
  9. service: google.cloud.speech.v1.Speech
  10. request:
  11. - field: audio.uri
  12. value: "gs://cloud-samples-data/speech/hello.wav"
  13. input_parameter: storage_uri
  14. comment: URI for audio file in Cloud Storage, e.g. gs://[BUCKET]/[FILE]
  15. - field: config.model
  16. value: "phone_call"
  17. input_parameter: model
  18. comment: |
  19. The transcription model to use, e.g. video, phone_call, default
  20. For a list of available transcription models, see:
  21. https://cloud.google.com/speech-to-text/docs/transcription-model#transcription_models
  22. - field: config.language_code
  23. value: "en-US"
  24. comment: The language of the supplied audio
  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