File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
google-cloud-speech/samples/snippets Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def transcribe_with_model_adaptation(
3434 parent = f"projects/{ project_id } /locations/{ location } "
3535
3636 # Create the custom class resource
37- custom_class_response = adaptation_client .create_custom_class (
37+ adaptation_client .create_custom_class (
3838 {
3939 "parent" : parent ,
4040 "custom_class_id" : custom_class_id ,
@@ -47,15 +47,19 @@ def transcribe_with_model_adaptation(
4747 },
4848 }
4949 )
50- custom_class_name = custom_class_response .name
50+ custom_class_name = (
51+ f"projects/{ project_id } /locations/{ location } /customClasses/{ custom_class_id } "
52+ )
5153 # Create the phrase set resource
5254 phrase_set_response = adaptation_client .create_phrase_set (
5355 {
5456 "parent" : parent ,
5557 "phrase_set_id" : phrase_set_id ,
5658 "phrase_set" : {
5759 "boost" : 10 ,
58- "phrases" : [{"value" : f"Visit restaurants like ${ custom_class_name } " }],
60+ "phrases" : [
61+ {"value" : f"Visit restaurants like ${{{ custom_class_name } }}" }
62+ ],
5963 },
6064 }
6165 )
@@ -88,4 +92,5 @@ def transcribe_with_model_adaptation(
8892 print ("Transcript: {}" .format (result .alternatives [0 ].transcript ))
8993
9094 # [END speech_transcribe_with_model_adaptation]
95+
9196 return response .results [0 ].alternatives [0 ].transcript
You can’t perform that action at this time.
0 commit comments