File tree 1 file changed +8
-3
lines changed
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(
34
34
parent = f"projects/{ project_id } /locations/{ location } "
35
35
36
36
# Create the custom class resource
37
- custom_class_response = adaptation_client .create_custom_class (
37
+ adaptation_client .create_custom_class (
38
38
{
39
39
"parent" : parent ,
40
40
"custom_class_id" : custom_class_id ,
@@ -47,15 +47,19 @@ def transcribe_with_model_adaptation(
47
47
},
48
48
}
49
49
)
50
- custom_class_name = custom_class_response .name
50
+ custom_class_name = (
51
+ f"projects/{ project_id } /locations/{ location } /customClasses/{ custom_class_id } "
52
+ )
51
53
# Create the phrase set resource
52
54
phrase_set_response = adaptation_client .create_phrase_set (
53
55
{
54
56
"parent" : parent ,
55
57
"phrase_set_id" : phrase_set_id ,
56
58
"phrase_set" : {
57
59
"boost" : 10 ,
58
- "phrases" : [{"value" : f"Visit restaurants like ${ custom_class_name } " }],
60
+ "phrases" : [
61
+ {"value" : f"Visit restaurants like ${{{ custom_class_name } }}" }
62
+ ],
59
63
},
60
64
}
61
65
)
@@ -88,4 +92,5 @@ def transcribe_with_model_adaptation(
88
92
print ("Transcript: {}" .format (result .alternatives [0 ].transcript ))
89
93
90
94
# [END speech_transcribe_with_model_adaptation]
95
+
91
96
return response .results [0 ].alternatives [0 ].transcript
You can’t perform that action at this time.
0 commit comments