dashscope 1.23.2__py3-none-any.whl → 1.23.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dashscope might be problematic. Click here for more details.
- dashscope/aigc/image_synthesis.py +47 -3
- dashscope/aigc/video_synthesis.py +69 -6
- dashscope/audio/asr/vocabulary.py +8 -7
- dashscope/audio/tts_v2/enrollment.py +13 -12
- dashscope/audio/tts_v2/speech_synthesizer.py +6 -6
- dashscope/version.py +1 -1
- {dashscope-1.23.2.dist-info → dashscope-1.23.4.dist-info}/METADATA +1 -1
- {dashscope-1.23.2.dist-info → dashscope-1.23.4.dist-info}/RECORD +12 -12
- {dashscope-1.23.2.dist-info → dashscope-1.23.4.dist-info}/LICENSE +0 -0
- {dashscope-1.23.2.dist-info → dashscope-1.23.4.dist-info}/WHEEL +0 -0
- {dashscope-1.23.2.dist-info → dashscope-1.23.4.dist-info}/entry_points.txt +0 -0
- {dashscope-1.23.2.dist-info → dashscope-1.23.4.dist-info}/top_level.txt +0 -0
|
@@ -19,6 +19,8 @@ class ImageSynthesis(BaseAsyncApi):
|
|
|
19
19
|
wanx_v1 = 'wanx-v1'
|
|
20
20
|
wanx_sketch_to_image_v1 = 'wanx-sketch-to-image-v1'
|
|
21
21
|
|
|
22
|
+
wanx_2_1_imageedit = 'wanx2.1-imageedit'
|
|
23
|
+
|
|
22
24
|
@classmethod
|
|
23
25
|
def call(cls,
|
|
24
26
|
model: str,
|
|
@@ -31,6 +33,9 @@ class ImageSynthesis(BaseAsyncApi):
|
|
|
31
33
|
workspace: str = None,
|
|
32
34
|
extra_input: Dict = None,
|
|
33
35
|
task: str = None,
|
|
36
|
+
function: str = None,
|
|
37
|
+
mask_image_url: str = None,
|
|
38
|
+
base_image_url: str = None,
|
|
34
39
|
**kwargs) -> ImageSynthesisResponse:
|
|
35
40
|
"""Call image(s) synthesis service and get result.
|
|
36
41
|
|
|
@@ -47,6 +52,11 @@ class ImageSynthesis(BaseAsyncApi):
|
|
|
47
52
|
workspace (str): The dashscope workspace id.
|
|
48
53
|
extra_input (Dict): The extra input parameters.
|
|
49
54
|
task (str): The task of api, ref doc.
|
|
55
|
+
function (str): The specific functions to be achieved. like:
|
|
56
|
+
colorization,super_resolution,expand,remove_watermaker,doodle,
|
|
57
|
+
description_edit_with_mask,description_edit,stylization_local,stylization_all
|
|
58
|
+
base_image_url (str): Enter the URL address of the target edited image.
|
|
59
|
+
mask_image_url (str): Provide the URL address of the image of the marked area by the user. It should be consistent with the image resolution of the base_image_url.
|
|
50
60
|
**kwargs:
|
|
51
61
|
n(int, `optional`): Number of images to synthesis.
|
|
52
62
|
size(str, `optional`): The output image(s) size(width*height).
|
|
@@ -74,6 +84,9 @@ class ImageSynthesis(BaseAsyncApi):
|
|
|
74
84
|
workspace=workspace,
|
|
75
85
|
extra_input=extra_input,
|
|
76
86
|
task=task,
|
|
87
|
+
function=function,
|
|
88
|
+
mask_image_url=mask_image_url,
|
|
89
|
+
base_image_url=base_image_url,
|
|
77
90
|
**kwargs)
|
|
78
91
|
|
|
79
92
|
@classmethod
|
|
@@ -88,6 +101,9 @@ class ImageSynthesis(BaseAsyncApi):
|
|
|
88
101
|
workspace: str = None,
|
|
89
102
|
extra_input: Dict = None,
|
|
90
103
|
task: str = None,
|
|
104
|
+
function: str = None,
|
|
105
|
+
mask_image_url: str = None,
|
|
106
|
+
base_image_url: str = None,
|
|
91
107
|
**kwargs) -> ImageSynthesisResponse:
|
|
92
108
|
"""Create a image(s) synthesis task, and return task information.
|
|
93
109
|
|
|
@@ -102,6 +118,11 @@ class ImageSynthesis(BaseAsyncApi):
|
|
|
102
118
|
workspace (str): The dashscope workspace id.
|
|
103
119
|
extra_input (Dict): The extra input parameters.
|
|
104
120
|
task (str): The task of api, ref doc.
|
|
121
|
+
function (str): The specific functions to be achieved. like:
|
|
122
|
+
colorization,super_resolution,expand,remove_watermaker,doodle,
|
|
123
|
+
description_edit_with_mask,description_edit,stylization_local,stylization_all
|
|
124
|
+
base_image_url (str): Enter the URL address of the target edited image.
|
|
125
|
+
mask_image_url (str): Provide the URL address of the image of the marked area by the user. It should be consistent with the image resolution of the base_image_url.
|
|
105
126
|
**kwargs(wanx-v1):
|
|
106
127
|
n(int, `optional`): Number of images to synthesis.
|
|
107
128
|
size: The output image(s) size, Default 1024*1024
|
|
@@ -122,7 +143,7 @@ class ImageSynthesis(BaseAsyncApi):
|
|
|
122
143
|
"""
|
|
123
144
|
if prompt is None or not prompt:
|
|
124
145
|
raise InputRequired('prompt is required!')
|
|
125
|
-
task_group,
|
|
146
|
+
task_group, f = _get_task_group_and_task(__name__)
|
|
126
147
|
input = {PROMPT: prompt}
|
|
127
148
|
has_upload = False
|
|
128
149
|
if negative_prompt is not None:
|
|
@@ -141,6 +162,24 @@ class ImageSynthesis(BaseAsyncApi):
|
|
|
141
162
|
if is_upload:
|
|
142
163
|
has_upload = True
|
|
143
164
|
input['ref_img'] = ref_img
|
|
165
|
+
|
|
166
|
+
if function is not None and function:
|
|
167
|
+
input['function'] = function
|
|
168
|
+
|
|
169
|
+
if mask_image_url is not None and mask_image_url:
|
|
170
|
+
is_upload, res_mask_image_url = check_and_upload_local(
|
|
171
|
+
model, mask_image_url, api_key)
|
|
172
|
+
if is_upload:
|
|
173
|
+
has_upload = True
|
|
174
|
+
input['mask_image_url'] = res_mask_image_url
|
|
175
|
+
|
|
176
|
+
if base_image_url is not None and base_image_url:
|
|
177
|
+
is_upload, res_base_image_url = check_and_upload_local(
|
|
178
|
+
model, base_image_url, api_key)
|
|
179
|
+
if is_upload:
|
|
180
|
+
has_upload = True
|
|
181
|
+
input['base_image_url'] = res_base_image_url
|
|
182
|
+
|
|
144
183
|
if extra_input is not None and extra_input:
|
|
145
184
|
input = {**input, **extra_input}
|
|
146
185
|
|
|
@@ -149,11 +188,16 @@ class ImageSynthesis(BaseAsyncApi):
|
|
|
149
188
|
headers['X-DashScope-OssResourceResolve'] = 'enable'
|
|
150
189
|
kwargs['headers'] = headers
|
|
151
190
|
|
|
191
|
+
if task is None:
|
|
192
|
+
task = ImageSynthesis.task
|
|
193
|
+
if model is not None and model and 'imageedit' in model:
|
|
194
|
+
task = 'image2image'
|
|
195
|
+
|
|
152
196
|
response = super().async_call(
|
|
153
197
|
model=model,
|
|
154
198
|
task_group=task_group,
|
|
155
|
-
task=
|
|
156
|
-
function=
|
|
199
|
+
task=task,
|
|
200
|
+
function=f,
|
|
157
201
|
api_key=api_key,
|
|
158
202
|
input=input,
|
|
159
203
|
workspace=workspace,
|
|
@@ -16,15 +16,25 @@ class VideoSynthesis(BaseAsyncApi):
|
|
|
16
16
|
"""API for video synthesis.
|
|
17
17
|
"""
|
|
18
18
|
class Models:
|
|
19
|
+
"""@deprecated, use wanx2.1-t2v-plus instead"""
|
|
19
20
|
wanx_txt2video_pro = 'wanx-txt2video-pro'
|
|
21
|
+
"""@deprecated, use wanx2.1-i2v-plus instead"""
|
|
20
22
|
wanx_img2video_pro = 'wanx-img2video-pro'
|
|
23
|
+
|
|
21
24
|
wanx_2_1_t2v_turbo = 'wanx2.1-t2v-turbo'
|
|
22
25
|
wanx_2_1_t2v_plus = 'wanx2.1-t2v-plus'
|
|
23
26
|
|
|
27
|
+
wanx_2_1_i2v_plus = 'wanx2.1-i2v-plus'
|
|
28
|
+
wanx_2_1_i2v_turbo = 'wanx2.1-i2v-turbo'
|
|
29
|
+
|
|
30
|
+
wanx_2_1_kf2v_plus = 'wanx2.1-kf2v-plus'
|
|
31
|
+
wanx_kf2v = 'wanx-kf2v'
|
|
32
|
+
|
|
24
33
|
@classmethod
|
|
25
34
|
def call(cls,
|
|
26
35
|
model: str,
|
|
27
|
-
prompt: Any,
|
|
36
|
+
prompt: Any = None,
|
|
37
|
+
# """@deprecated, use prompt_extend in parameters """
|
|
28
38
|
extend_prompt: bool = True,
|
|
29
39
|
negative_prompt: str = None,
|
|
30
40
|
template: str = None,
|
|
@@ -33,13 +43,17 @@ class VideoSynthesis(BaseAsyncApi):
|
|
|
33
43
|
extra_input: Dict = None,
|
|
34
44
|
workspace: str = None,
|
|
35
45
|
task: str = None,
|
|
46
|
+
head_frame: str = None,
|
|
47
|
+
tail_frame: str = None,
|
|
48
|
+
first_frame_url: str = None,
|
|
49
|
+
last_frame_url: str = None,
|
|
36
50
|
**kwargs) -> VideoSynthesisResponse:
|
|
37
51
|
"""Call video synthesis service and get result.
|
|
38
52
|
|
|
39
53
|
Args:
|
|
40
54
|
model (str): The model, reference ``Models``.
|
|
41
55
|
prompt (Any): The prompt for video synthesis.
|
|
42
|
-
extend_prompt (bool):
|
|
56
|
+
extend_prompt (bool): @deprecated, use prompt_extend in parameters
|
|
43
57
|
negative_prompt (str): The negative prompt is the opposite of the prompt meaning.
|
|
44
58
|
template (str): LoRa input, such as gufeng, katong, etc.
|
|
45
59
|
img_url (str): The input image url, Generate the URL of the image referenced by the video.
|
|
@@ -47,6 +61,8 @@ class VideoSynthesis(BaseAsyncApi):
|
|
|
47
61
|
workspace (str): The dashscope workspace id.
|
|
48
62
|
extra_input (Dict): The extra input parameters.
|
|
49
63
|
task (str): The task of api, ref doc.
|
|
64
|
+
first_frame_url (str): The URL of the first frame image for generating the video.
|
|
65
|
+
last_frame_url (str): The URL of the last frame image for generating the video.
|
|
50
66
|
**kwargs:
|
|
51
67
|
size(str, `optional`): The output video size(width*height).
|
|
52
68
|
duration(int, optional): The duration. Duration of video generation. The default value is 5, in seconds.
|
|
@@ -68,13 +84,18 @@ class VideoSynthesis(BaseAsyncApi):
|
|
|
68
84
|
workspace=workspace,
|
|
69
85
|
extra_input=extra_input,
|
|
70
86
|
task=task,
|
|
87
|
+
head_frame=head_frame,
|
|
88
|
+
tail_frame=tail_frame,
|
|
89
|
+
first_frame_url=first_frame_url,
|
|
90
|
+
last_frame_url=last_frame_url,
|
|
71
91
|
**kwargs)
|
|
72
92
|
|
|
73
93
|
@classmethod
|
|
74
94
|
def async_call(cls,
|
|
75
95
|
model: str,
|
|
76
|
-
prompt: Any,
|
|
96
|
+
prompt: Any = None,
|
|
77
97
|
img_url: str = None,
|
|
98
|
+
# """@deprecated, use prompt_extend in parameters """
|
|
78
99
|
extend_prompt: bool = True,
|
|
79
100
|
negative_prompt: str = None,
|
|
80
101
|
template: str = None,
|
|
@@ -82,13 +103,17 @@ class VideoSynthesis(BaseAsyncApi):
|
|
|
82
103
|
extra_input: Dict = None,
|
|
83
104
|
workspace: str = None,
|
|
84
105
|
task: str = None,
|
|
106
|
+
head_frame: str = None,
|
|
107
|
+
tail_frame: str = None,
|
|
108
|
+
first_frame_url: str = None,
|
|
109
|
+
last_frame_url: str = None,
|
|
85
110
|
**kwargs) -> VideoSynthesisResponse:
|
|
86
111
|
"""Create a video synthesis task, and return task information.
|
|
87
112
|
|
|
88
113
|
Args:
|
|
89
114
|
model (str): The model, reference ``Models``.
|
|
90
115
|
prompt (Any): The prompt for video synthesis.
|
|
91
|
-
extend_prompt (bool):
|
|
116
|
+
extend_prompt (bool): @deprecated, use prompt_extend in parameters
|
|
92
117
|
negative_prompt (str): The negative prompt is the opposite of the prompt meaning.
|
|
93
118
|
template (str): LoRa input, such as gufeng, katong, etc.
|
|
94
119
|
img_url (str): The input image url, Generate the URL of the image referenced by the video.
|
|
@@ -96,6 +121,8 @@ class VideoSynthesis(BaseAsyncApi):
|
|
|
96
121
|
workspace (str): The dashscope workspace id.
|
|
97
122
|
extra_input (Dict): The extra input parameters.
|
|
98
123
|
task (str): The task of api, ref doc.
|
|
124
|
+
first_frame_url (str): The URL of the first frame image for generating the video.
|
|
125
|
+
last_frame_url (str): The URL of the last frame image for generating the video.
|
|
99
126
|
**kwargs:
|
|
100
127
|
size(str, `optional`): The output video size(width*height).
|
|
101
128
|
duration(int, optional): The duration. Duration of video generation. The default value is 5, in seconds.
|
|
@@ -108,27 +135,63 @@ class VideoSynthesis(BaseAsyncApi):
|
|
|
108
135
|
DashScopeAPIResponse: The video synthesis
|
|
109
136
|
task id in the response.
|
|
110
137
|
"""
|
|
111
|
-
if prompt is None or not prompt:
|
|
112
|
-
raise InputRequired('prompt is required!')
|
|
113
138
|
task_group, function = _get_task_group_and_task(__name__)
|
|
114
139
|
inputs = {PROMPT: prompt, 'extend_prompt': extend_prompt}
|
|
115
140
|
if negative_prompt:
|
|
116
141
|
inputs['negative_prompt'] = negative_prompt
|
|
117
142
|
if template:
|
|
118
143
|
inputs['template'] = template
|
|
144
|
+
if function:
|
|
145
|
+
inputs['function'] = function
|
|
146
|
+
|
|
119
147
|
has_upload = False
|
|
148
|
+
|
|
120
149
|
if img_url is not None and img_url:
|
|
121
150
|
is_upload, res_img_url = check_and_upload_local(
|
|
122
151
|
model, img_url, api_key)
|
|
123
152
|
if is_upload:
|
|
124
153
|
has_upload = True
|
|
125
154
|
inputs['img_url'] = res_img_url
|
|
155
|
+
|
|
156
|
+
if head_frame is not None and head_frame:
|
|
157
|
+
is_upload, res_head_frame = check_and_upload_local(
|
|
158
|
+
model, head_frame, api_key)
|
|
159
|
+
if is_upload:
|
|
160
|
+
has_upload = True
|
|
161
|
+
inputs['head_frame'] = res_head_frame
|
|
162
|
+
|
|
163
|
+
if tail_frame is not None and tail_frame:
|
|
164
|
+
is_upload, res_tail_frame = check_and_upload_local(
|
|
165
|
+
model, tail_frame, api_key)
|
|
166
|
+
if is_upload:
|
|
167
|
+
has_upload = True
|
|
168
|
+
inputs['tail_frame'] = res_tail_frame
|
|
169
|
+
|
|
170
|
+
if first_frame_url is not None and first_frame_url:
|
|
171
|
+
is_upload, res_first_frame_url = check_and_upload_local(
|
|
172
|
+
model, first_frame_url, api_key)
|
|
173
|
+
if is_upload:
|
|
174
|
+
has_upload = True
|
|
175
|
+
inputs['first_frame_url'] = res_first_frame_url
|
|
176
|
+
|
|
177
|
+
if last_frame_url is not None and last_frame_url:
|
|
178
|
+
is_upload, res_last_frame_url = check_and_upload_local(
|
|
179
|
+
model, last_frame_url, api_key)
|
|
180
|
+
if is_upload:
|
|
181
|
+
has_upload = True
|
|
182
|
+
inputs['last_frame_url'] = res_last_frame_url
|
|
183
|
+
|
|
126
184
|
if extra_input is not None and extra_input:
|
|
127
185
|
inputs = {**inputs, **extra_input}
|
|
128
186
|
if has_upload:
|
|
129
187
|
headers = kwargs.pop('headers', {})
|
|
130
188
|
headers['X-DashScope-OssResourceResolve'] = 'enable'
|
|
131
189
|
kwargs['headers'] = headers
|
|
190
|
+
|
|
191
|
+
if task is None:
|
|
192
|
+
task = VideoSynthesis.task
|
|
193
|
+
if model is not None and model and 'kf2v' in model:
|
|
194
|
+
task = 'image2video'
|
|
132
195
|
response = super().async_call(
|
|
133
196
|
model=model,
|
|
134
197
|
task_group=task_group,
|
|
@@ -12,14 +12,15 @@ from dashscope.common.logging import logger
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class VocabularyServiceException(Exception):
|
|
15
|
-
def __init__(self, status_code: int, code: str,
|
|
15
|
+
def __init__(self, request_id: str, status_code: int, code: str,
|
|
16
16
|
error_message: str) -> None:
|
|
17
|
+
self._request_id = request_id
|
|
17
18
|
self._status_code = status_code
|
|
18
19
|
self._code = code
|
|
19
20
|
self._error_message = error_message
|
|
20
21
|
|
|
21
22
|
def __str__(self):
|
|
22
|
-
return f'Status Code: {self._status_code}, Code: {self._code}, Error Message: {self._error_message}'
|
|
23
|
+
return f'Request: {self._request_id}, Status Code: {self._status_code}, Code: {self._code}, Error Message: {self._error_message}'
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
class VocabularyService(BaseApi):
|
|
@@ -86,7 +87,7 @@ class VocabularyService(BaseApi):
|
|
|
86
87
|
self._last_request_id = response.request_id
|
|
87
88
|
return response.output['vocabulary_id']
|
|
88
89
|
else:
|
|
89
|
-
raise VocabularyServiceException(response.status_code,
|
|
90
|
+
raise VocabularyServiceException(response.request_id, response.status_code,
|
|
90
91
|
response.code, response.message)
|
|
91
92
|
|
|
92
93
|
def list_vocabularies(self,
|
|
@@ -117,7 +118,7 @@ class VocabularyService(BaseApi):
|
|
|
117
118
|
self._last_request_id = response.request_id
|
|
118
119
|
return response.output['vocabulary_list']
|
|
119
120
|
else:
|
|
120
|
-
raise VocabularyServiceException(response.status_code,
|
|
121
|
+
raise VocabularyServiceException(response.request_id, response.status_code,
|
|
121
122
|
response.code, response.message)
|
|
122
123
|
|
|
123
124
|
def query_vocabulary(self, vocabulary_id: str) -> List[dict]:
|
|
@@ -134,7 +135,7 @@ class VocabularyService(BaseApi):
|
|
|
134
135
|
self._last_request_id = response.request_id
|
|
135
136
|
return response.output
|
|
136
137
|
else:
|
|
137
|
-
raise VocabularyServiceException(response.status_code,
|
|
138
|
+
raise VocabularyServiceException(response.request_id, response.status_code,
|
|
138
139
|
response.code, response.message)
|
|
139
140
|
|
|
140
141
|
def update_vocabulary(self, vocabulary_id: str,
|
|
@@ -153,7 +154,7 @@ class VocabularyService(BaseApi):
|
|
|
153
154
|
self._last_request_id = response.request_id
|
|
154
155
|
return
|
|
155
156
|
else:
|
|
156
|
-
raise VocabularyServiceException(response.status_code,
|
|
157
|
+
raise VocabularyServiceException(response.request_id, response.status_code,
|
|
157
158
|
response.code, response.message)
|
|
158
159
|
|
|
159
160
|
def delete_vocabulary(self, vocabulary_id: str) -> None:
|
|
@@ -169,7 +170,7 @@ class VocabularyService(BaseApi):
|
|
|
169
170
|
self._last_request_id = response.request_id
|
|
170
171
|
return
|
|
171
172
|
else:
|
|
172
|
-
raise VocabularyServiceException(response.status_code,
|
|
173
|
+
raise VocabularyServiceException(response.request_id, response.status_code,
|
|
173
174
|
response.code, response.message)
|
|
174
175
|
|
|
175
176
|
def get_last_request_id(self):
|
|
@@ -12,14 +12,15 @@ from dashscope.common.logging import logger
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class VoiceEnrollmentException(Exception):
|
|
15
|
-
def __init__(self, status_code: int, code: str,
|
|
15
|
+
def __init__(self, request_id: str, status_code: int, code: str,
|
|
16
16
|
error_message: str) -> None:
|
|
17
|
+
self._request_id = request_id
|
|
17
18
|
self._status_code = status_code
|
|
18
19
|
self._code = code
|
|
19
20
|
self._error_message = error_message
|
|
20
21
|
|
|
21
22
|
def __str__(self):
|
|
22
|
-
return f'Status Code: {self._status_code}, Code: {self._code}, Error Message: {self._error_message}'
|
|
23
|
+
return f'Request: {self._request_id}, Status Code: {self._status_code}, Code: {self._code}, Error Message: {self._error_message}'
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
class VoiceEnrollmentService(BaseApi):
|
|
@@ -81,11 +82,11 @@ class VoiceEnrollmentService(BaseApi):
|
|
|
81
82
|
'prefix': prefix,
|
|
82
83
|
'url': url,
|
|
83
84
|
}, )
|
|
85
|
+
self._last_request_id = response.request_id
|
|
84
86
|
if response.status_code == 200:
|
|
85
|
-
self._last_request_id = response.request_id
|
|
86
87
|
return response.output['voice_id']
|
|
87
88
|
else:
|
|
88
|
-
raise VoiceEnrollmentException(response.status_code, response.code,
|
|
89
|
+
raise VoiceEnrollmentException(response.request_id, response.status_code, response.code,
|
|
89
90
|
response.message)
|
|
90
91
|
|
|
91
92
|
def list_voices(self,
|
|
@@ -111,11 +112,11 @@ class VoiceEnrollmentService(BaseApi):
|
|
|
111
112
|
'page_index': page_index,
|
|
112
113
|
'page_size': page_size,
|
|
113
114
|
}, )
|
|
115
|
+
self._last_request_id = response.request_id
|
|
114
116
|
if response.status_code == 200:
|
|
115
|
-
self._last_request_id = response.request_id
|
|
116
117
|
return response.output['voice_list']
|
|
117
118
|
else:
|
|
118
|
-
raise VoiceEnrollmentException(response.status_code, response.code,
|
|
119
|
+
raise VoiceEnrollmentException(response.request_id, response.status_code, response.code,
|
|
119
120
|
response.message)
|
|
120
121
|
|
|
121
122
|
def query_voice(self, voice_id: str) -> List[str]:
|
|
@@ -128,11 +129,11 @@ class VoiceEnrollmentService(BaseApi):
|
|
|
128
129
|
'action': 'query_voice',
|
|
129
130
|
'voice_id': voice_id,
|
|
130
131
|
}, )
|
|
132
|
+
self._last_request_id = response.request_id
|
|
131
133
|
if response.status_code == 200:
|
|
132
|
-
self._last_request_id = response.request_id
|
|
133
134
|
return response.output
|
|
134
135
|
else:
|
|
135
|
-
raise VoiceEnrollmentException(response.status_code, response.code,
|
|
136
|
+
raise VoiceEnrollmentException(response.request_id, response.status_code, response.code,
|
|
136
137
|
response.message)
|
|
137
138
|
|
|
138
139
|
def update_voice(self, voice_id: str, url: str) -> None:
|
|
@@ -146,11 +147,11 @@ class VoiceEnrollmentService(BaseApi):
|
|
|
146
147
|
'voice_id': voice_id,
|
|
147
148
|
'url': url,
|
|
148
149
|
}, )
|
|
150
|
+
self._last_request_id = response.request_id
|
|
149
151
|
if response.status_code == 200:
|
|
150
|
-
self._last_request_id = response.request_id
|
|
151
152
|
return
|
|
152
153
|
else:
|
|
153
|
-
raise VoiceEnrollmentException(response.status_code, response.code,
|
|
154
|
+
raise VoiceEnrollmentException(response.request_id, response.status_code, response.code,
|
|
154
155
|
response.message)
|
|
155
156
|
|
|
156
157
|
def delete_voice(self, voice_id: str) -> None:
|
|
@@ -162,11 +163,11 @@ class VoiceEnrollmentService(BaseApi):
|
|
|
162
163
|
'action': 'delete_voice',
|
|
163
164
|
'voice_id': voice_id,
|
|
164
165
|
}, )
|
|
166
|
+
self._last_request_id = response.request_id
|
|
165
167
|
if response.status_code == 200:
|
|
166
|
-
self._last_request_id = response.request_id
|
|
167
168
|
return
|
|
168
169
|
else:
|
|
169
|
-
raise VoiceEnrollmentException(response.status_code, response.code,
|
|
170
|
+
raise VoiceEnrollmentException(response.request_id, response.status_code, response.code,
|
|
170
171
|
response.message)
|
|
171
172
|
|
|
172
173
|
def get_last_request_id(self):
|
|
@@ -134,9 +134,7 @@ class Request:
|
|
|
134
134
|
'task_group': 'audio',
|
|
135
135
|
'task': 'tts',
|
|
136
136
|
'function': 'SpeechSynthesizer',
|
|
137
|
-
'input': {
|
|
138
|
-
'text': ''
|
|
139
|
-
},
|
|
137
|
+
'input': {},
|
|
140
138
|
'parameters': {
|
|
141
139
|
'voice': self.voice,
|
|
142
140
|
'volume': self.volume,
|
|
@@ -179,9 +177,7 @@ class Request:
|
|
|
179
177
|
'streaming': WebsocketStreamingMode.DUPLEX,
|
|
180
178
|
},
|
|
181
179
|
'payload': {
|
|
182
|
-
'input': {
|
|
183
|
-
'text': ''
|
|
184
|
-
},
|
|
180
|
+
'input': {},
|
|
185
181
|
},
|
|
186
182
|
}
|
|
187
183
|
return json.dumps(cmd)
|
|
@@ -514,6 +510,10 @@ class SpeechSynthesizer:
|
|
|
514
510
|
otherwise, it will wait indefinitely.
|
|
515
511
|
"""
|
|
516
512
|
# print('还不支持非流式语音合成sdk调用大模型,使用流式模拟')
|
|
513
|
+
if self.additional_params is None:
|
|
514
|
+
self.additional_params = {"enable_ssml":True}
|
|
515
|
+
else:
|
|
516
|
+
self.additional_params["enable_ssml"] = True
|
|
517
517
|
if not self.callback:
|
|
518
518
|
self.callback = ResultCallback()
|
|
519
519
|
self.__start_stream()
|
dashscope/version.py
CHANGED
|
@@ -3,15 +3,15 @@ dashscope/cli.py,sha256=amegoTkGOs6TlHMdoo4JVOqBePo3lGs745rc7leEyrE,24020
|
|
|
3
3
|
dashscope/files.py,sha256=vRDQygm3lOqBZR73o7KNHs1iTBVuvLncuwJNxIYjzAU,3981
|
|
4
4
|
dashscope/model.py,sha256=B5v_BtYLPqj6raClejBgdKg6WTGwhH_f-20pvsQqmsk,1491
|
|
5
5
|
dashscope/models.py,sha256=dE4mzXkl85G343qVylSGpURPRdA5pZSqXlx6PcxqC_Q,1275
|
|
6
|
-
dashscope/version.py,sha256=
|
|
6
|
+
dashscope/version.py,sha256=rYR28JeS4-X9sqFHDXfo67jzYyRueQgOduJuayh5uEs,74
|
|
7
7
|
dashscope/aigc/__init__.py,sha256=AuRhu_vA1K0tbs_C6DgcZYhTvxMuzDgpwHJNHzEPIHg,442
|
|
8
8
|
dashscope/aigc/chat_completion.py,sha256=ONlyyssIbfaKKcFo7cEKhHx5OCF2XX810HFzIExW1ho,14813
|
|
9
9
|
dashscope/aigc/code_generation.py,sha256=p_mxDKJLQMW0IjFD46JRlZuEZCRESSVKEfLlAevBtqw,10936
|
|
10
10
|
dashscope/aigc/conversation.py,sha256=95xEEY4ThZJysj5zy3aMw7ql9KLJVfD_1iHv9QZ17Ew,14282
|
|
11
11
|
dashscope/aigc/generation.py,sha256=xMcMu16rICTdjZiD_sPqYV_Ltdp4ewGzzfC7JD9VApY,17948
|
|
12
|
-
dashscope/aigc/image_synthesis.py,sha256=
|
|
12
|
+
dashscope/aigc/image_synthesis.py,sha256=Jgqmyv4jRxikgX7J18QrKKQ4OZAMxs6Q6YXObae3DhI,13363
|
|
13
13
|
dashscope/aigc/multimodal_conversation.py,sha256=1rZZRk_1lCdbVs7Rx1kJ5LvwWE1put5p_dQKdCX0ysY,5574
|
|
14
|
-
dashscope/aigc/video_synthesis.py,sha256=
|
|
14
|
+
dashscope/aigc/video_synthesis.py,sha256=XQ3-NKYFmj5cIbUbLTbI0-FyC_fQp8eds6QmD1ZHj_0,13015
|
|
15
15
|
dashscope/api_entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
dashscope/api_entities/aiohttp_request.py,sha256=1L7XdIJ9L65cQmX8x9JCR4t5hNIMDrbiWADfKKp9yfo,10280
|
|
17
17
|
dashscope/api_entities/api_request_data.py,sha256=04rpYPNK1HkT3iTPJmZpquH621xcBbe8R8EGrDJSLt0,5514
|
|
@@ -34,14 +34,14 @@ dashscope/audio/asr/asr_phrase_manager.py,sha256=vHOLExaKCtjedkihIu7gyfQyarR9rN5
|
|
|
34
34
|
dashscope/audio/asr/recognition.py,sha256=b_aAPvOKjpWdSiYhM_hp30sZ06QdmNBSDJwhiv78kHM,20932
|
|
35
35
|
dashscope/audio/asr/transcription.py,sha256=lYzPjh7jJQwjMoxx8-AY0YCMBKNKO0bi7xd5tZGSHPc,9094
|
|
36
36
|
dashscope/audio/asr/translation_recognizer.py,sha256=JgBmhkIl_kqH8uVwop6Fba5KlXccftKFrhaygN9PKjU,39680
|
|
37
|
-
dashscope/audio/asr/vocabulary.py,sha256=
|
|
37
|
+
dashscope/audio/asr/vocabulary.py,sha256=N0pMS2x1lDxqJ14FgTGKctfuVkR2_hlEsCNWFcgYpTY,6717
|
|
38
38
|
dashscope/audio/qwen_tts/__init__.py,sha256=JS3axY1grqO0aTIJufZ3KS1JsU6yf6y4K2CQlNvUK9I,132
|
|
39
39
|
dashscope/audio/qwen_tts/speech_synthesizer.py,sha256=7LHR-PXhn-VE1cCOp_82Jq0zE9rMc3xy3dszUeyLLNs,2927
|
|
40
40
|
dashscope/audio/tts/__init__.py,sha256=xYpMFseUZGgqgj_70zcX2VsLv-L7qxJ3d-bbdj_hO0I,245
|
|
41
41
|
dashscope/audio/tts/speech_synthesizer.py,sha256=vD1xQV-rew8qAsIaAGH5amsNtB0SqdtNhVHhJHGQ-xk,7622
|
|
42
42
|
dashscope/audio/tts_v2/__init__.py,sha256=me9a3_7KsHQxcJ8hx4SeKlY1e_ThHVvGMw7Yn0uoscM,333
|
|
43
|
-
dashscope/audio/tts_v2/enrollment.py,sha256
|
|
44
|
-
dashscope/audio/tts_v2/speech_synthesizer.py,sha256=
|
|
43
|
+
dashscope/audio/tts_v2/enrollment.py,sha256=-nrlywYSOP73Bm9ETTSxNnlp-B8ezJcUmd59mVvyvgk,6361
|
|
44
|
+
dashscope/audio/tts_v2/speech_synthesizer.py,sha256=qUoLga8HpvNVdbN5n_orxrgZ28yD6Lhwuwqeoi1T7yA,20056
|
|
45
45
|
dashscope/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
46
|
dashscope/client/base_api.py,sha256=aWNy_xm02GXuLKVgWnYJht2nI4ZHSGfYIcr52SML15A,41239
|
|
47
47
|
dashscope/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -87,9 +87,9 @@ dashscope/tokenizers/tokenizer.py,sha256=3FQVDvMNkCW9ccYeJdjrd_PIMMD3Xv7aNZkaYOE
|
|
|
87
87
|
dashscope/tokenizers/tokenizer_base.py,sha256=5EJIFuizMWESEmLmbd38yJnfeHmPnzZPwsO4aOGjpl4,707
|
|
88
88
|
dashscope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
89
|
dashscope/utils/oss_utils.py,sha256=L5LN3lN8etVxSL_jkZydstvEKpnTG9CY0zcvPGQ5LBo,7383
|
|
90
|
-
dashscope-1.23.
|
|
91
|
-
dashscope-1.23.
|
|
92
|
-
dashscope-1.23.
|
|
93
|
-
dashscope-1.23.
|
|
94
|
-
dashscope-1.23.
|
|
95
|
-
dashscope-1.23.
|
|
90
|
+
dashscope-1.23.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
91
|
+
dashscope-1.23.4.dist-info/METADATA,sha256=AyHZs_Sy4pMKuqtcXIb7HeYRho4kWAxr8T5yD3tia-o,6798
|
|
92
|
+
dashscope-1.23.4.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
93
|
+
dashscope-1.23.4.dist-info/entry_points.txt,sha256=raEp5dOuj8whJ7yqZlDM8WQ5p2RfnGrGNo0QLQEnatY,50
|
|
94
|
+
dashscope-1.23.4.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
|
|
95
|
+
dashscope-1.23.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|