speech_transcribe_enhanced_model.yaml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto
  2. schema_version: 1.2.0
  3. samples:
  4. - region_tag: speech_transcribe_enhanced_model
  5. title: Using Enhanced Models (Local File)
  6. description: Transcribe a short audio file using an enhanced model
  7. rpc: Recognize
  8. service: google.cloud.speech.v1.Speech
  9. request:
  10. - field: audio.content
  11. value: "resources/hello.wav"
  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.model
  16. value: "phone_call"
  17. comment: |
  18. The enhanced model to use, e.g. phone_call
  19. - field: config.use_enhanced
  20. value: true
  21. comment: |
  22. Use an enhanced model for speech recognition (when set to true).
  23. Project must be eligible for requesting enhanced models.
  24. Enhanced speech models require that you opt-in to data logging.
  25. - field: config.language_code
  26. value: "en-US"
  27. comment: The language of the supplied audio
  28. response:
  29. - loop:
  30. variable: result
  31. collection: $resp.results
  32. body:
  33. - comment:
  34. - First alternative is the most probable result
  35. - define: alternative = result.alternatives[0]
  36. - print:
  37. - "Transcript: %s"
  38. - alternative.transcript