tencentcloud-sdk-python-aiart 3.0.847__tar.gz
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.
- tencentcloud-sdk-python-aiart-3.0.847/PKG-INFO +45 -0
- tencentcloud-sdk-python-aiart-3.0.847/README.rst +27 -0
- tencentcloud-sdk-python-aiart-3.0.847/setup.cfg +8 -0
- tencentcloud-sdk-python-aiart-3.0.847/setup.py +31 -0
- tencentcloud-sdk-python-aiart-3.0.847/tencentcloud/__init__.py +17 -0
- tencentcloud-sdk-python-aiart-3.0.847/tencentcloud/aiart/__init__.py +0 -0
- tencentcloud-sdk-python-aiart-3.0.847/tencentcloud/aiart/v20221229/__init__.py +0 -0
- tencentcloud-sdk-python-aiart-3.0.847/tencentcloud/aiart/v20221229/aiart_client.py +82 -0
- tencentcloud-sdk-python-aiart-3.0.847/tencentcloud/aiart/v20221229/errorcodes.py +93 -0
- tencentcloud-sdk-python-aiart-3.0.847/tencentcloud/aiart/v20221229/models.py +306 -0
- tencentcloud-sdk-python-aiart-3.0.847/tencentcloud_sdk_python_aiart.egg-info/PKG-INFO +45 -0
- tencentcloud-sdk-python-aiart-3.0.847/tencentcloud_sdk_python_aiart.egg-info/SOURCES.txt +13 -0
- tencentcloud-sdk-python-aiart-3.0.847/tencentcloud_sdk_python_aiart.egg-info/dependency_links.txt +1 -0
- tencentcloud-sdk-python-aiart-3.0.847/tencentcloud_sdk_python_aiart.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 1.1
|
|
2
|
+
Name: tencentcloud-sdk-python-aiart
|
|
3
|
+
Version: 3.0.847
|
|
4
|
+
Summary: Tencent Cloud Aiart SDK for Python
|
|
5
|
+
Home-page: https://github.com/TencentCloud/tencentcloud-sdk-python
|
|
6
|
+
Author: Tencent Cloud
|
|
7
|
+
Author-email: tencentcloudapi@tencent.com
|
|
8
|
+
License: Apache License 2.0
|
|
9
|
+
Description: ============================
|
|
10
|
+
Tencent Cloud SDK for Python
|
|
11
|
+
============================
|
|
12
|
+
|
|
13
|
+
Tencent Cloud Python Aiart SDK is the official software development kit, which allows Python developers to write software that makes use of Tencent Cloud services like CVM and CBS.
|
|
14
|
+
The SDK works on Python versions:
|
|
15
|
+
|
|
16
|
+
* 2.7 and greater, including 3.x
|
|
17
|
+
|
|
18
|
+
Quick Start
|
|
19
|
+
-----------
|
|
20
|
+
|
|
21
|
+
First, install the library:
|
|
22
|
+
|
|
23
|
+
.. code-block:: sh
|
|
24
|
+
|
|
25
|
+
$ pip install tencentcloud-sdk-python-common
|
|
26
|
+
$ pip install tencentcloud-sdk-python-aiart
|
|
27
|
+
|
|
28
|
+
or download source code from github and install:
|
|
29
|
+
|
|
30
|
+
.. code-block:: sh
|
|
31
|
+
|
|
32
|
+
$ git clone https://github.com/tencentcloud/tencentcloud-sdk-python.git
|
|
33
|
+
$ cd tencentcloud-sdk-python
|
|
34
|
+
$ python package.py --components common aiart
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Platform: any
|
|
38
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
39
|
+
Classifier: Intended Audience :: Developers
|
|
40
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
41
|
+
Classifier: Programming Language :: Python
|
|
42
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
43
|
+
Classifier: Programming Language :: Python :: 3
|
|
44
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
45
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
============================
|
|
2
|
+
Tencent Cloud SDK for Python
|
|
3
|
+
============================
|
|
4
|
+
|
|
5
|
+
Tencent Cloud Python Aiart SDK is the official software development kit, which allows Python developers to write software that makes use of Tencent Cloud services like CVM and CBS.
|
|
6
|
+
The SDK works on Python versions:
|
|
7
|
+
|
|
8
|
+
* 2.7 and greater, including 3.x
|
|
9
|
+
|
|
10
|
+
Quick Start
|
|
11
|
+
-----------
|
|
12
|
+
|
|
13
|
+
First, install the library:
|
|
14
|
+
|
|
15
|
+
.. code-block:: sh
|
|
16
|
+
|
|
17
|
+
$ pip install tencentcloud-sdk-python-common
|
|
18
|
+
$ pip install tencentcloud-sdk-python-aiart
|
|
19
|
+
|
|
20
|
+
or download source code from github and install:
|
|
21
|
+
|
|
22
|
+
.. code-block:: sh
|
|
23
|
+
|
|
24
|
+
$ git clone https://github.com/tencentcloud/tencentcloud-sdk-python.git
|
|
25
|
+
$ cd tencentcloud-sdk-python
|
|
26
|
+
$ python package.py --components common aiart
|
|
27
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import os
|
|
3
|
+
from setuptools import setup, find_packages
|
|
4
|
+
|
|
5
|
+
import tencentcloud
|
|
6
|
+
|
|
7
|
+
ROOT = os.path.dirname(__file__)
|
|
8
|
+
|
|
9
|
+
setup(
|
|
10
|
+
name='tencentcloud-sdk-python-aiart',
|
|
11
|
+
version=tencentcloud.__version__,
|
|
12
|
+
description='Tencent Cloud Aiart SDK for Python',
|
|
13
|
+
long_description=open('README.rst').read(),
|
|
14
|
+
author='Tencent Cloud',
|
|
15
|
+
url='https://github.com/TencentCloud/tencentcloud-sdk-python',
|
|
16
|
+
maintainer_email="tencentcloudapi@tencent.com",
|
|
17
|
+
scripts=[],
|
|
18
|
+
packages=find_packages(exclude=["tests*"]),
|
|
19
|
+
license="Apache License 2.0",
|
|
20
|
+
platforms='any',
|
|
21
|
+
classifiers=[
|
|
22
|
+
'Development Status :: 5 - Production/Stable',
|
|
23
|
+
'Intended Audience :: Developers',
|
|
24
|
+
'License :: OSI Approved :: Apache Software License',
|
|
25
|
+
'Programming Language :: Python',
|
|
26
|
+
'Programming Language :: Python :: 2.7',
|
|
27
|
+
'Programming Language :: Python :: 3',
|
|
28
|
+
'Programming Language :: Python :: 3.6',
|
|
29
|
+
'Programming Language :: Python :: 3.7',
|
|
30
|
+
],
|
|
31
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 1999-2018 Tencent Ltd.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
__version__ = '3.0.847'
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# -*- coding: utf8 -*-
|
|
2
|
+
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
|
|
19
|
+
from tencentcloud.common.abstract_client import AbstractClient
|
|
20
|
+
from tencentcloud.aiart.v20221229 import models
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class AiartClient(AbstractClient):
|
|
24
|
+
_apiVersion = '2022-12-29'
|
|
25
|
+
_endpoint = 'aiart.tencentcloudapi.com'
|
|
26
|
+
_service = 'aiart'
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def ImageToImage(self, request):
|
|
30
|
+
"""智能图生图接口将根据输入的图片及辅助描述文本,智能生成与之相关的结果图。
|
|
31
|
+
输入:单边分辨率小于2000、转成 Base64 字符串后小于 5MB 的图片,建议同时输入描述文本。
|
|
32
|
+
输出:对应风格及分辨率的 AI 生成图。
|
|
33
|
+
可支持的风格详见 [智能图生图风格列表](https://cloud.tencent.com/document/product/1668/86250),请将列表中的“风格编号”传入 Styles 数组,建议选择一种风格。
|
|
34
|
+
|
|
35
|
+
请求频率限制为1次/秒。
|
|
36
|
+
|
|
37
|
+
:param request: Request instance for ImageToImage.
|
|
38
|
+
:type request: :class:`tencentcloud.aiart.v20221229.models.ImageToImageRequest`
|
|
39
|
+
:rtype: :class:`tencentcloud.aiart.v20221229.models.ImageToImageResponse`
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
try:
|
|
43
|
+
params = request._serialize()
|
|
44
|
+
headers = request.headers
|
|
45
|
+
body = self.call("ImageToImage", params, headers=headers)
|
|
46
|
+
response = json.loads(body)
|
|
47
|
+
model = models.ImageToImageResponse()
|
|
48
|
+
model._deserialize(response["Response"])
|
|
49
|
+
return model
|
|
50
|
+
except Exception as e:
|
|
51
|
+
if isinstance(e, TencentCloudSDKException):
|
|
52
|
+
raise
|
|
53
|
+
else:
|
|
54
|
+
raise TencentCloudSDKException(e.message, e.message)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def TextToImage(self, request):
|
|
58
|
+
"""智能文生图接口将根据输入的描述文本,智能生成与之相关的结果图。
|
|
59
|
+
输入:512个字符以内的描述性文本,推荐使用中文。
|
|
60
|
+
输出:对应风格及分辨率的 AI 生成图。
|
|
61
|
+
可支持的风格详见 [智能文生图风格列表](https://cloud.tencent.com/document/product/1668/86249),请将列表中的“风格编号”传入 Styles 数组,建议选择一种风格。
|
|
62
|
+
|
|
63
|
+
请求频率限制为1次/秒。
|
|
64
|
+
|
|
65
|
+
:param request: Request instance for TextToImage.
|
|
66
|
+
:type request: :class:`tencentcloud.aiart.v20221229.models.TextToImageRequest`
|
|
67
|
+
:rtype: :class:`tencentcloud.aiart.v20221229.models.TextToImageResponse`
|
|
68
|
+
|
|
69
|
+
"""
|
|
70
|
+
try:
|
|
71
|
+
params = request._serialize()
|
|
72
|
+
headers = request.headers
|
|
73
|
+
body = self.call("TextToImage", params, headers=headers)
|
|
74
|
+
response = json.loads(body)
|
|
75
|
+
model = models.TextToImageResponse()
|
|
76
|
+
model._deserialize(response["Response"])
|
|
77
|
+
return model
|
|
78
|
+
except Exception as e:
|
|
79
|
+
if isinstance(e, TencentCloudSDKException):
|
|
80
|
+
raise
|
|
81
|
+
else:
|
|
82
|
+
raise TencentCloudSDKException(e.message, e.message)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# -*- coding: utf8 -*-
|
|
2
|
+
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# 控制台服务异常。
|
|
18
|
+
FAILEDOPERATION_CONSOLESERVERERROR = 'FailedOperation.ConsoleServerError'
|
|
19
|
+
|
|
20
|
+
# 生成图片审核不通过,请重试。
|
|
21
|
+
FAILEDOPERATION_GENERATEIMAGEFAILED = 'FailedOperation.GenerateImageFailed'
|
|
22
|
+
|
|
23
|
+
# 图片解码失败。
|
|
24
|
+
FAILEDOPERATION_IMAGEDECODEFAILED = 'FailedOperation.ImageDecodeFailed'
|
|
25
|
+
|
|
26
|
+
# 图片下载错误。
|
|
27
|
+
FAILEDOPERATION_IMAGEDOWNLOADERROR = 'FailedOperation.ImageDownloadError'
|
|
28
|
+
|
|
29
|
+
# 图片分辨率过大,超过2000*2000。
|
|
30
|
+
FAILEDOPERATION_IMAGERESOLUTIONEXCEED = 'FailedOperation.ImageResolutionExceed'
|
|
31
|
+
|
|
32
|
+
# base64编码后的图片数据大小不超过10M。
|
|
33
|
+
FAILEDOPERATION_IMAGESIZEEXCEED = 'FailedOperation.ImageSizeExceed'
|
|
34
|
+
|
|
35
|
+
# 整个请求体太大(通常主要是图片)。
|
|
36
|
+
FAILEDOPERATION_REQUESTENTITYTOOLARGE = 'FailedOperation.RequestEntityTooLarge'
|
|
37
|
+
|
|
38
|
+
# 后端服务超时。
|
|
39
|
+
FAILEDOPERATION_REQUESTTIMEOUT = 'FailedOperation.RequestTimeout'
|
|
40
|
+
|
|
41
|
+
# RPC请求失败,一般为算法微服务故障。
|
|
42
|
+
FAILEDOPERATION_RPCFAIL = 'FailedOperation.RpcFail'
|
|
43
|
+
|
|
44
|
+
# 服务内部错误。
|
|
45
|
+
FAILEDOPERATION_SERVERERROR = 'FailedOperation.ServerError'
|
|
46
|
+
|
|
47
|
+
# 未知错误。
|
|
48
|
+
FAILEDOPERATION_UNKNOWN = 'FailedOperation.Unknown'
|
|
49
|
+
|
|
50
|
+
# 参数不合法。
|
|
51
|
+
INVALIDPARAMETER_INVALIDPARAMETER = 'InvalidParameter.InvalidParameter'
|
|
52
|
+
|
|
53
|
+
# 图片为空。
|
|
54
|
+
INVALIDPARAMETERVALUE_IMAGEEMPTY = 'InvalidParameterValue.ImageEmpty'
|
|
55
|
+
|
|
56
|
+
# 参数字段或者值有误
|
|
57
|
+
INVALIDPARAMETERVALUE_PARAMETERVALUEERROR = 'InvalidParameterValue.ParameterValueError'
|
|
58
|
+
|
|
59
|
+
# 1xx和其他风格不可混合使用。
|
|
60
|
+
INVALIDPARAMETERVALUE_STYLECONFLICT = 'InvalidParameterValue.StyleConflict'
|
|
61
|
+
|
|
62
|
+
# 输入文本过长,请更换短一点的文本后重试。
|
|
63
|
+
INVALIDPARAMETERVALUE_TEXTLENGTHEXCEED = 'InvalidParameterValue.TextLengthExceed'
|
|
64
|
+
|
|
65
|
+
# URL格式不合法。
|
|
66
|
+
INVALIDPARAMETERVALUE_URLILLEGAL = 'InvalidParameterValue.UrlIllegal'
|
|
67
|
+
|
|
68
|
+
# 图片包含非法信息,审核不通过。
|
|
69
|
+
OPERATIONDENIED_IMAGEILLEGALDETECTED = 'OperationDenied.ImageIllegalDetected'
|
|
70
|
+
|
|
71
|
+
# 文本包含非法信息,审核不通过。
|
|
72
|
+
OPERATIONDENIED_TEXTILLEGALDETECTED = 'OperationDenied.TextIllegalDetected'
|
|
73
|
+
|
|
74
|
+
# 请求的次数超过了频率限制。
|
|
75
|
+
REQUESTLIMITEXCEEDED = 'RequestLimitExceeded'
|
|
76
|
+
|
|
77
|
+
# 资源正在发货中。
|
|
78
|
+
RESOURCEUNAVAILABLE_DELIVERING = 'ResourceUnavailable.Delivering'
|
|
79
|
+
|
|
80
|
+
# 帐号已欠费。
|
|
81
|
+
RESOURCEUNAVAILABLE_INARREARS = 'ResourceUnavailable.InArrears'
|
|
82
|
+
|
|
83
|
+
# 余额不足。
|
|
84
|
+
RESOURCEUNAVAILABLE_LOWBALANCE = 'ResourceUnavailable.LowBalance'
|
|
85
|
+
|
|
86
|
+
# 计费状态未知,请确认是否已在控制台开通服务。
|
|
87
|
+
RESOURCEUNAVAILABLE_NOTEXIST = 'ResourceUnavailable.NotExist'
|
|
88
|
+
|
|
89
|
+
# 帐号已停服。
|
|
90
|
+
RESOURCEUNAVAILABLE_STOPUSING = 'ResourceUnavailable.StopUsing'
|
|
91
|
+
|
|
92
|
+
# 计费状态异常。
|
|
93
|
+
RESOURCESSOLDOUT_CHARGESTATUSEXCEPTION = 'ResourcesSoldOut.ChargeStatusException'
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
# -*- coding: utf8 -*-
|
|
2
|
+
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import warnings
|
|
17
|
+
|
|
18
|
+
from tencentcloud.common.abstract_model import AbstractModel
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ImageToImageRequest(AbstractModel):
|
|
22
|
+
"""ImageToImage请求参数结构体
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def __init__(self):
|
|
27
|
+
r"""
|
|
28
|
+
:param InputImage: 输入图 Base64 数据。
|
|
29
|
+
算法将根据输入的图片,结合文本描述智能生成与之相关的图像。
|
|
30
|
+
Base64 和 Url 必须提供一个,如果都提供以 Base64 为准。
|
|
31
|
+
图片限制:单边分辨率小于2000,转成 Base64 字符串后小于 5MB。
|
|
32
|
+
:type InputImage: str
|
|
33
|
+
:param InputUrl: 输入图 Url。
|
|
34
|
+
算法将根据输入的图片,结合文本描述智能生成与之相关的图像。
|
|
35
|
+
Base64 和 Url 必须提供一个,如果都提供以 Base64 为准。
|
|
36
|
+
图片限制:单边分辨率小于2000,转成 Base64 字符串后小于 5MB。
|
|
37
|
+
:type InputUrl: str
|
|
38
|
+
:param Prompt: 文本描述。
|
|
39
|
+
用于在输入图的基础上引导生成图效果,建议详细描述画面主体、细节、场景等,文本描述越丰富,生成效果越精美。推荐使用中文。最多支持512个 utf-8 字符。
|
|
40
|
+
注意:如果不输入任何文本描述,可能导致较差的效果,建议根据期望的效果输入相应的文本描述。
|
|
41
|
+
:type Prompt: str
|
|
42
|
+
:param NegativePrompt: 反向文本描述。
|
|
43
|
+
用于一定程度上从反面引导模型生成的走向,减少生成结果中出现描述内容的可能,但不能完全杜绝。
|
|
44
|
+
推荐使用中文。最多可传512个 utf-8 字符。
|
|
45
|
+
:type NegativePrompt: str
|
|
46
|
+
:param Styles: 绘画风格。
|
|
47
|
+
请在 [智能图生图风格列表](https://cloud.tencent.com/document/product/1668/86250) 中选择期望的风格,传入风格编号。
|
|
48
|
+
推荐使用且只使用一种风格。不传默认使用201(日系动漫风格)。
|
|
49
|
+
如果想要探索风格列表之外的风格,也可以尝试在 Prompt 中输入其他的风格描述。
|
|
50
|
+
:type Styles: list of str
|
|
51
|
+
:param ResultConfig: 生成图结果的配置,包括输出图片分辨率和尺寸等。
|
|
52
|
+
:type ResultConfig: :class:`tencentcloud.aiart.v20221229.models.ResultConfig`
|
|
53
|
+
:param LogoAdd: 为生成结果图添加标识的开关,默认为1。
|
|
54
|
+
1:添加标识。
|
|
55
|
+
0:不添加标识。
|
|
56
|
+
其他数值:默认按1处理。
|
|
57
|
+
建议您使用显著标识来提示结果图使用了 AI 绘画技术,是 AI 生成的图片。
|
|
58
|
+
:type LogoAdd: int
|
|
59
|
+
:param LogoParam: 标识内容设置。
|
|
60
|
+
默认在生成结果图右下角添加“图片由 AI 生成”字样,您可根据自身需要替换为其他的标识图片。
|
|
61
|
+
:type LogoParam: :class:`tencentcloud.aiart.v20221229.models.LogoParam`
|
|
62
|
+
:param Strength: 生成自由度。
|
|
63
|
+
Strength 值越小,生成图和原图越接近。取值范围0~1,不传默认为0.6。
|
|
64
|
+
:type Strength: float
|
|
65
|
+
"""
|
|
66
|
+
self.InputImage = None
|
|
67
|
+
self.InputUrl = None
|
|
68
|
+
self.Prompt = None
|
|
69
|
+
self.NegativePrompt = None
|
|
70
|
+
self.Styles = None
|
|
71
|
+
self.ResultConfig = None
|
|
72
|
+
self.LogoAdd = None
|
|
73
|
+
self.LogoParam = None
|
|
74
|
+
self.Strength = None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _deserialize(self, params):
|
|
78
|
+
self.InputImage = params.get("InputImage")
|
|
79
|
+
self.InputUrl = params.get("InputUrl")
|
|
80
|
+
self.Prompt = params.get("Prompt")
|
|
81
|
+
self.NegativePrompt = params.get("NegativePrompt")
|
|
82
|
+
self.Styles = params.get("Styles")
|
|
83
|
+
if params.get("ResultConfig") is not None:
|
|
84
|
+
self.ResultConfig = ResultConfig()
|
|
85
|
+
self.ResultConfig._deserialize(params.get("ResultConfig"))
|
|
86
|
+
self.LogoAdd = params.get("LogoAdd")
|
|
87
|
+
if params.get("LogoParam") is not None:
|
|
88
|
+
self.LogoParam = LogoParam()
|
|
89
|
+
self.LogoParam._deserialize(params.get("LogoParam"))
|
|
90
|
+
self.Strength = params.get("Strength")
|
|
91
|
+
memeber_set = set(params.keys())
|
|
92
|
+
for name, value in vars(self).items():
|
|
93
|
+
if name in memeber_set:
|
|
94
|
+
memeber_set.remove(name)
|
|
95
|
+
if len(memeber_set) > 0:
|
|
96
|
+
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class ImageToImageResponse(AbstractModel):
|
|
101
|
+
"""ImageToImage返回参数结构体
|
|
102
|
+
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
def __init__(self):
|
|
106
|
+
r"""
|
|
107
|
+
:param ResultImage: 返回的生成图 Base64 编码。
|
|
108
|
+
:type ResultImage: str
|
|
109
|
+
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
|
|
110
|
+
:type RequestId: str
|
|
111
|
+
"""
|
|
112
|
+
self.ResultImage = None
|
|
113
|
+
self.RequestId = None
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _deserialize(self, params):
|
|
117
|
+
self.ResultImage = params.get("ResultImage")
|
|
118
|
+
self.RequestId = params.get("RequestId")
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class LogoParam(AbstractModel):
|
|
122
|
+
"""logo参数
|
|
123
|
+
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
def __init__(self):
|
|
127
|
+
r"""
|
|
128
|
+
:param LogoUrl: 水印url
|
|
129
|
+
注意:此字段可能返回 null,表示取不到有效值。
|
|
130
|
+
:type LogoUrl: str
|
|
131
|
+
:param LogoImage: 水印base64,url和base64二选一传入
|
|
132
|
+
注意:此字段可能返回 null,表示取不到有效值。
|
|
133
|
+
:type LogoImage: str
|
|
134
|
+
:param LogoRect: 水印图片位于融合结果图中的坐标,将按照坐标对标识图片进行位置和大小的拉伸匹配
|
|
135
|
+
注意:此字段可能返回 null,表示取不到有效值。
|
|
136
|
+
:type LogoRect: :class:`tencentcloud.aiart.v20221229.models.LogoRect`
|
|
137
|
+
"""
|
|
138
|
+
self.LogoUrl = None
|
|
139
|
+
self.LogoImage = None
|
|
140
|
+
self.LogoRect = None
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def _deserialize(self, params):
|
|
144
|
+
self.LogoUrl = params.get("LogoUrl")
|
|
145
|
+
self.LogoImage = params.get("LogoImage")
|
|
146
|
+
if params.get("LogoRect") is not None:
|
|
147
|
+
self.LogoRect = LogoRect()
|
|
148
|
+
self.LogoRect._deserialize(params.get("LogoRect"))
|
|
149
|
+
memeber_set = set(params.keys())
|
|
150
|
+
for name, value in vars(self).items():
|
|
151
|
+
if name in memeber_set:
|
|
152
|
+
memeber_set.remove(name)
|
|
153
|
+
if len(memeber_set) > 0:
|
|
154
|
+
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class LogoRect(AbstractModel):
|
|
159
|
+
"""输入框
|
|
160
|
+
|
|
161
|
+
"""
|
|
162
|
+
|
|
163
|
+
def __init__(self):
|
|
164
|
+
r"""
|
|
165
|
+
:param X: 左上角X坐标
|
|
166
|
+
注意:此字段可能返回 null,表示取不到有效值。
|
|
167
|
+
:type X: int
|
|
168
|
+
:param Y: 左上角Y坐标
|
|
169
|
+
注意:此字段可能返回 null,表示取不到有效值。
|
|
170
|
+
:type Y: int
|
|
171
|
+
:param Width: 方框宽度
|
|
172
|
+
注意:此字段可能返回 null,表示取不到有效值。
|
|
173
|
+
:type Width: int
|
|
174
|
+
:param Height: 方框高度
|
|
175
|
+
注意:此字段可能返回 null,表示取不到有效值。
|
|
176
|
+
:type Height: int
|
|
177
|
+
"""
|
|
178
|
+
self.X = None
|
|
179
|
+
self.Y = None
|
|
180
|
+
self.Width = None
|
|
181
|
+
self.Height = None
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def _deserialize(self, params):
|
|
185
|
+
self.X = params.get("X")
|
|
186
|
+
self.Y = params.get("Y")
|
|
187
|
+
self.Width = params.get("Width")
|
|
188
|
+
self.Height = params.get("Height")
|
|
189
|
+
memeber_set = set(params.keys())
|
|
190
|
+
for name, value in vars(self).items():
|
|
191
|
+
if name in memeber_set:
|
|
192
|
+
memeber_set.remove(name)
|
|
193
|
+
if len(memeber_set) > 0:
|
|
194
|
+
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class ResultConfig(AbstractModel):
|
|
199
|
+
"""返回结果配置
|
|
200
|
+
|
|
201
|
+
"""
|
|
202
|
+
|
|
203
|
+
def __init__(self):
|
|
204
|
+
r"""
|
|
205
|
+
:param Resolution: 生成图分辨率
|
|
206
|
+
支持生成以下不同分辨率的图片,对应1:1方图、3:4竖图、4:3横图三种尺寸规格,不传默认为"768:768"
|
|
207
|
+
取值:
|
|
208
|
+
● 768:768
|
|
209
|
+
● 768:1024
|
|
210
|
+
● 1024:768
|
|
211
|
+
注意:此字段可能返回 null,表示取不到有效值。
|
|
212
|
+
:type Resolution: str
|
|
213
|
+
"""
|
|
214
|
+
self.Resolution = None
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def _deserialize(self, params):
|
|
218
|
+
self.Resolution = params.get("Resolution")
|
|
219
|
+
memeber_set = set(params.keys())
|
|
220
|
+
for name, value in vars(self).items():
|
|
221
|
+
if name in memeber_set:
|
|
222
|
+
memeber_set.remove(name)
|
|
223
|
+
if len(memeber_set) > 0:
|
|
224
|
+
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
class TextToImageRequest(AbstractModel):
|
|
229
|
+
"""TextToImage请求参数结构体
|
|
230
|
+
|
|
231
|
+
"""
|
|
232
|
+
|
|
233
|
+
def __init__(self):
|
|
234
|
+
r"""
|
|
235
|
+
:param Prompt: 文本描述。
|
|
236
|
+
算法将根据输入的文本智能生成与之相关的图像。建议详细描述画面主体、细节、场景等,文本描述越丰富,生成效果越精美。
|
|
237
|
+
不能为空,推荐使用中文。最多可传512个 utf-8 字符。
|
|
238
|
+
:type Prompt: str
|
|
239
|
+
:param NegativePrompt: 反向文本描述。
|
|
240
|
+
用于一定程度上从反面引导模型生成的走向,减少生成结果中出现描述内容的可能,但不能完全杜绝。
|
|
241
|
+
推荐使用中文。最多可传512个 utf-8 字符。
|
|
242
|
+
:type NegativePrompt: str
|
|
243
|
+
:param Styles: 绘画风格。
|
|
244
|
+
请在 [智能文生图风格列表](https://cloud.tencent.com/document/product/1668/86249) 中选择期望的风格,传入风格编号。
|
|
245
|
+
推荐使用且只使用一种风格。不传默认使用201(日系动漫风格)。
|
|
246
|
+
如果想要探索风格列表之外的风格,也可以尝试在 Prompt 中输入其他的风格描述。
|
|
247
|
+
:type Styles: list of str
|
|
248
|
+
:param ResultConfig: 生成图结果的配置,包括输出图片分辨率和尺寸等。
|
|
249
|
+
:type ResultConfig: :class:`tencentcloud.aiart.v20221229.models.ResultConfig`
|
|
250
|
+
:param LogoAdd: 为生成结果图添加标识的开关,默认为1。
|
|
251
|
+
1:添加标识。
|
|
252
|
+
0:不添加标识。
|
|
253
|
+
其他数值:默认按1处理。
|
|
254
|
+
建议您使用显著标识来提示结果图使用了 AI 绘画技术,是 AI 生成的图片。
|
|
255
|
+
:type LogoAdd: int
|
|
256
|
+
:param LogoParam: 标识内容设置。
|
|
257
|
+
默认在生成结果图右下角添加“图片由 AI 生成”字样,您可根据自身需要替换为其他的标识图片。
|
|
258
|
+
:type LogoParam: :class:`tencentcloud.aiart.v20221229.models.LogoParam`
|
|
259
|
+
"""
|
|
260
|
+
self.Prompt = None
|
|
261
|
+
self.NegativePrompt = None
|
|
262
|
+
self.Styles = None
|
|
263
|
+
self.ResultConfig = None
|
|
264
|
+
self.LogoAdd = None
|
|
265
|
+
self.LogoParam = None
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def _deserialize(self, params):
|
|
269
|
+
self.Prompt = params.get("Prompt")
|
|
270
|
+
self.NegativePrompt = params.get("NegativePrompt")
|
|
271
|
+
self.Styles = params.get("Styles")
|
|
272
|
+
if params.get("ResultConfig") is not None:
|
|
273
|
+
self.ResultConfig = ResultConfig()
|
|
274
|
+
self.ResultConfig._deserialize(params.get("ResultConfig"))
|
|
275
|
+
self.LogoAdd = params.get("LogoAdd")
|
|
276
|
+
if params.get("LogoParam") is not None:
|
|
277
|
+
self.LogoParam = LogoParam()
|
|
278
|
+
self.LogoParam._deserialize(params.get("LogoParam"))
|
|
279
|
+
memeber_set = set(params.keys())
|
|
280
|
+
for name, value in vars(self).items():
|
|
281
|
+
if name in memeber_set:
|
|
282
|
+
memeber_set.remove(name)
|
|
283
|
+
if len(memeber_set) > 0:
|
|
284
|
+
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
class TextToImageResponse(AbstractModel):
|
|
289
|
+
"""TextToImage返回参数结构体
|
|
290
|
+
|
|
291
|
+
"""
|
|
292
|
+
|
|
293
|
+
def __init__(self):
|
|
294
|
+
r"""
|
|
295
|
+
:param ResultImage: 返回的生成图 Base64 编码。
|
|
296
|
+
:type ResultImage: str
|
|
297
|
+
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
|
|
298
|
+
:type RequestId: str
|
|
299
|
+
"""
|
|
300
|
+
self.ResultImage = None
|
|
301
|
+
self.RequestId = None
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def _deserialize(self, params):
|
|
305
|
+
self.ResultImage = params.get("ResultImage")
|
|
306
|
+
self.RequestId = params.get("RequestId")
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 1.1
|
|
2
|
+
Name: tencentcloud-sdk-python-aiart
|
|
3
|
+
Version: 3.0.847
|
|
4
|
+
Summary: Tencent Cloud Aiart SDK for Python
|
|
5
|
+
Home-page: https://github.com/TencentCloud/tencentcloud-sdk-python
|
|
6
|
+
Author: Tencent Cloud
|
|
7
|
+
Author-email: tencentcloudapi@tencent.com
|
|
8
|
+
License: Apache License 2.0
|
|
9
|
+
Description: ============================
|
|
10
|
+
Tencent Cloud SDK for Python
|
|
11
|
+
============================
|
|
12
|
+
|
|
13
|
+
Tencent Cloud Python Aiart SDK is the official software development kit, which allows Python developers to write software that makes use of Tencent Cloud services like CVM and CBS.
|
|
14
|
+
The SDK works on Python versions:
|
|
15
|
+
|
|
16
|
+
* 2.7 and greater, including 3.x
|
|
17
|
+
|
|
18
|
+
Quick Start
|
|
19
|
+
-----------
|
|
20
|
+
|
|
21
|
+
First, install the library:
|
|
22
|
+
|
|
23
|
+
.. code-block:: sh
|
|
24
|
+
|
|
25
|
+
$ pip install tencentcloud-sdk-python-common
|
|
26
|
+
$ pip install tencentcloud-sdk-python-aiart
|
|
27
|
+
|
|
28
|
+
or download source code from github and install:
|
|
29
|
+
|
|
30
|
+
.. code-block:: sh
|
|
31
|
+
|
|
32
|
+
$ git clone https://github.com/tencentcloud/tencentcloud-sdk-python.git
|
|
33
|
+
$ cd tencentcloud-sdk-python
|
|
34
|
+
$ python package.py --components common aiart
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Platform: any
|
|
38
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
39
|
+
Classifier: Intended Audience :: Developers
|
|
40
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
41
|
+
Classifier: Programming Language :: Python
|
|
42
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
43
|
+
Classifier: Programming Language :: Python :: 3
|
|
44
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
45
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
README.rst
|
|
2
|
+
setup.cfg
|
|
3
|
+
setup.py
|
|
4
|
+
tencentcloud/__init__.py
|
|
5
|
+
tencentcloud/aiart/__init__.py
|
|
6
|
+
tencentcloud/aiart/v20221229/__init__.py
|
|
7
|
+
tencentcloud/aiart/v20221229/aiart_client.py
|
|
8
|
+
tencentcloud/aiart/v20221229/errorcodes.py
|
|
9
|
+
tencentcloud/aiart/v20221229/models.py
|
|
10
|
+
tencentcloud_sdk_python_aiart.egg-info/PKG-INFO
|
|
11
|
+
tencentcloud_sdk_python_aiart.egg-info/SOURCES.txt
|
|
12
|
+
tencentcloud_sdk_python_aiart.egg-info/dependency_links.txt
|
|
13
|
+
tencentcloud_sdk_python_aiart.egg-info/top_level.txt
|
tencentcloud-sdk-python-aiart-3.0.847/tencentcloud_sdk_python_aiart.egg-info/dependency_links.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tencentcloud
|