Skip to content

Commit 7a3767c

Browse files
songguocolakevinlin09
authored andcommitted
feat(model/cosyvoice-v3):add language hints to voice clone
1 parent ff382fc commit 7a3767c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

dashscope/audio/tts_v2/enrollment.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,25 @@ def __call_with_input(self, input):
6868
logger.debug('>>>>recv', response)
6969
return response
7070

71-
def create_voice(self, target_model: str, prefix: str, url: str) -> str:
71+
def create_voice(self, target_model: str, prefix: str, url: str, language_hints: List[str] = None) -> str:
7272
'''
7373
创建新克隆音色
7474
param: target_model 克隆音色对应的语音合成模型版本
7575
param: prefix 音色自定义前缀,仅允许数字和小写字母,小于十个字符。
7676
param: url 用于克隆的音频文件url
77+
param: language_hints 克隆音色目标语言
7778
return: voice_id
7879
'''
79-
response = self.__call_with_input(input={
80+
81+
input_params = {
8082
'action': 'create_voice',
8183
'target_model': target_model,
8284
'prefix': prefix,
83-
'url': url,
84-
}, )
85+
'url': url
86+
}
87+
if language_hints is not None:
88+
input_params['language_hints'] = language_hints
89+
response = self.__call_with_input(input_params)
8590
self._last_request_id = response.request_id
8691
if response.status_code == 200:
8792
return response.output['voice_id']

0 commit comments

Comments
 (0)