tencentcloud-sdk-aiart 3.0.526

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6f72ef2a8744b83478bfdb6c67b5b79ec815b03b
4
+ data.tar.gz: 3d8e1fa69ad46479c5e6e820338731de050c38b4
5
+ SHA512:
6
+ metadata.gz: 788836c46f9b139eb3be427dcfe27166f025160490de04966f72f40be85e4fac31e2c3b3c979b9868eabf3f5e3a3e29b075e93c03c3314f035aa235f15d27663
7
+ data.tar.gz: 43c3092724bb028bcd0d5c8b85a3a465b02a587390e532547d8cdb878d272ac270448cd69a6784d4c2709d178ff978010751336405cfe23049abc9c36a87ee02
data/lib/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.0.526
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tencentcloud-sdk-common'
4
+
5
+ require_relative 'v20221229/client'
6
+ require_relative 'v20221229/models'
7
+
8
+ module TencentCloud
9
+ module Aiart
10
+ end
11
+ end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'json'
18
+
19
+ module TencentCloud
20
+ module Aiart
21
+ module V20221229
22
+ class Client < TencentCloud::Common::AbstractClient
23
+
24
+ def initialize(credential, region, profile = nil)
25
+ api_version = '2022-12-29'
26
+ api_endpoint = 'aiart.tencentcloudapi.com'
27
+ sdk_version = 'AIART_' + File.read(File.expand_path('../VERSION', __dir__)).strip
28
+ super(credential, region, api_version, api_endpoint, sdk_version, profile)
29
+ end
30
+
31
+
32
+ # 智能图生图接口将根据输入的图片及辅助描述文本,智能生成与之相关的结果图。
33
+ # 输入:单边分辨率小于2000、转成 Base64 字符串后小于 5MB 的图片,建议同时输入描述文本。
34
+ # 输出:对应风格及分辨率的 AI 生成图。
35
+ # 可支持的风格详见 [智能图生图风格列表](https://cloud.tencent.com/document/product/1668/86250),请将列表中的“风格编号”传入 Styles 数组,建议选择一种风格。
36
+
37
+ # 请求频率限制为1次/秒。
38
+
39
+ # @param request: Request instance for ImageToImage.
40
+ # @type request: :class:`Tencentcloud::aiart::V20221229::ImageToImageRequest`
41
+ # @rtype: :class:`Tencentcloud::aiart::V20221229::ImageToImageResponse`
42
+ def ImageToImage(request)
43
+ body = send_request('ImageToImage', request.serialize)
44
+ response = JSON.parse(body)
45
+ if response['Response'].key?('Error') == false
46
+ model = ImageToImageResponse.new
47
+ model.deserialize(response['Response'])
48
+ model
49
+ else
50
+ code = response['Response']['Error']['Code']
51
+ message = response['Response']['Error']['Message']
52
+ reqid = response['Response']['RequestId']
53
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
54
+ end
55
+ rescue TencentCloud::Common::TencentCloudSDKException => e
56
+ raise e
57
+ rescue StandardError => e
58
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
59
+ end
60
+
61
+ # 智能文生图接口将根据输入的描述文本,智能生成与之相关的结果图。
62
+ # 输入:512个字符以内的描述性文本,推荐使用中文。
63
+ # 输出:对应风格及分辨率的 AI 生成图。
64
+ # 可支持的风格详见 [智能文生图风格列表](https://cloud.tencent.com/document/product/1668/86249),请将列表中的“风格编号”传入 Styles 数组,建议选择一种风格。
65
+
66
+ # 请求频率限制为1次/秒。
67
+
68
+ # @param request: Request instance for TextToImage.
69
+ # @type request: :class:`Tencentcloud::aiart::V20221229::TextToImageRequest`
70
+ # @rtype: :class:`Tencentcloud::aiart::V20221229::TextToImageResponse`
71
+ def TextToImage(request)
72
+ body = send_request('TextToImage', request.serialize)
73
+ response = JSON.parse(body)
74
+ if response['Response'].key?('Error') == false
75
+ model = TextToImageResponse.new
76
+ model.deserialize(response['Response'])
77
+ model
78
+ else
79
+ code = response['Response']['Error']['Code']
80
+ message = response['Response']['Error']['Message']
81
+ reqid = response['Response']['RequestId']
82
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
83
+ end
84
+ rescue TencentCloud::Common::TencentCloudSDKException => e
85
+ raise e
86
+ rescue StandardError => e
87
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
88
+ end
89
+
90
+
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,274 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ module TencentCloud
18
+ module Aiart
19
+ module V20221229
20
+ # ImageToImage请求参数结构体
21
+ class ImageToImageRequest < TencentCloud::Common::AbstractModel
22
+ # @param InputImage: 输入图 Base64 数据。
23
+ # 算法将根据输入的图片,结合文本描述智能生成与之相关的图像。
24
+ # Base64 和 Url 必须提供一个,如果都提供以 Base64 为准。
25
+ # 图片限制:单边分辨率小于2000,转成 Base64 字符串后小于 5MB。
26
+ # @type InputImage: String
27
+ # @param InputUrl: 输入图 Url。
28
+ # 算法将根据输入的图片,结合文本描述智能生成与之相关的图像。
29
+ # Base64 和 Url 必须提供一个,如果都提供以 Base64 为准。
30
+ # 图片限制:单边分辨率小于2000,转成 Base64 字符串后小于 5MB。
31
+ # @type InputUrl: String
32
+ # @param Prompt: 文本描述。
33
+ # 用于在输入图的基础上引导生成图效果,建议详细描述画面主体、细节、场景等,文本描述越丰富,生成效果越精美。推荐使用中文。最多支持512个 utf-8 字符。
34
+ # 注意:如果不输入任何文本描述,可能导致较差的效果,建议根据期望的效果输入相应的文本描述。
35
+ # @type Prompt: String
36
+ # @param NegativePrompt: 反向文本描述。
37
+ # 用于一定程度上从反面引导模型生成的走向,减少生成结果中出现描述内容的可能,但不能完全杜绝。
38
+ # 推荐使用中文。最多可传512个 utf-8 字符。
39
+ # @type NegativePrompt: String
40
+ # @param Styles: 绘画风格。
41
+ # 请在 [智能图生图风格列表](https://cloud.tencent.com/document/product/1668/86250) 中选择期望的风格,传入风格编号。
42
+ # 推荐使用且只使用一种风格。不传默认使用201(日系动漫风格)。
43
+ # 如果想要探索风格列表之外的风格,也可以尝试在 Prompt 中输入其他的风格描述。
44
+ # @type Styles: Array
45
+ # @param ResultConfig: 生成图结果的配置,包括输出图片分辨率和尺寸等。
46
+ # @type ResultConfig: :class:`Tencentcloud::Aiart.v20221229.models.ResultConfig`
47
+ # @param LogoAdd: 为生成结果图添加标识的开关,默认为1。
48
+ # 1:添加标识。
49
+ # 0:不添加标识。
50
+ # 其他数值:默认按1处理。
51
+ # 建议您使用显著标识来提示结果图使用了 AI 绘画技术,是 AI 生成的图片。
52
+ # @type LogoAdd: Integer
53
+ # @param LogoParam: 标识内容设置。
54
+ # 默认在生成结果图右下角添加“图片由 AI 生成”字样,您可根据自身需要替换为其他的标识图片。
55
+ # @type LogoParam: :class:`Tencentcloud::Aiart.v20221229.models.LogoParam`
56
+ # @param Strength: 生成自由度。
57
+ # Strength 值越小,生成图和原图越接近。取值范围0~1,不传默认为0.6。
58
+ # @type Strength: Float
59
+
60
+ attr_accessor :InputImage, :InputUrl, :Prompt, :NegativePrompt, :Styles, :ResultConfig, :LogoAdd, :LogoParam, :Strength
61
+
62
+ def initialize(inputimage=nil, inputurl=nil, prompt=nil, negativeprompt=nil, styles=nil, resultconfig=nil, logoadd=nil, logoparam=nil, strength=nil)
63
+ @InputImage = inputimage
64
+ @InputUrl = inputurl
65
+ @Prompt = prompt
66
+ @NegativePrompt = negativeprompt
67
+ @Styles = styles
68
+ @ResultConfig = resultconfig
69
+ @LogoAdd = logoadd
70
+ @LogoParam = logoparam
71
+ @Strength = strength
72
+ end
73
+
74
+ def deserialize(params)
75
+ @InputImage = params['InputImage']
76
+ @InputUrl = params['InputUrl']
77
+ @Prompt = params['Prompt']
78
+ @NegativePrompt = params['NegativePrompt']
79
+ @Styles = params['Styles']
80
+ unless params['ResultConfig'].nil?
81
+ @ResultConfig = ResultConfig.new
82
+ @ResultConfig.deserialize(params['ResultConfig'])
83
+ end
84
+ @LogoAdd = params['LogoAdd']
85
+ unless params['LogoParam'].nil?
86
+ @LogoParam = LogoParam.new
87
+ @LogoParam.deserialize(params['LogoParam'])
88
+ end
89
+ @Strength = params['Strength']
90
+ end
91
+ end
92
+
93
+ # ImageToImage返回参数结构体
94
+ class ImageToImageResponse < TencentCloud::Common::AbstractModel
95
+ # @param ResultImage: 返回的生成图 Base64 编码。
96
+ # @type ResultImage: String
97
+ # @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
98
+ # @type RequestId: String
99
+
100
+ attr_accessor :ResultImage, :RequestId
101
+
102
+ def initialize(resultimage=nil, requestid=nil)
103
+ @ResultImage = resultimage
104
+ @RequestId = requestid
105
+ end
106
+
107
+ def deserialize(params)
108
+ @ResultImage = params['ResultImage']
109
+ @RequestId = params['RequestId']
110
+ end
111
+ end
112
+
113
+ # logo参数
114
+ class LogoParam < TencentCloud::Common::AbstractModel
115
+ # @param LogoUrl: 水印url
116
+ # 注意:此字段可能返回 null,表示取不到有效值。
117
+ # @type LogoUrl: String
118
+ # @param LogoImage: 水印base64,url和base64二选一传入
119
+ # 注意:此字段可能返回 null,表示取不到有效值。
120
+ # @type LogoImage: String
121
+ # @param LogoRect: 水印图片位于融合结果图中的坐标,将按照坐标对标识图片进行位置和大小的拉伸匹配
122
+ # 注意:此字段可能返回 null,表示取不到有效值。
123
+ # @type LogoRect: :class:`Tencentcloud::Aiart.v20221229.models.LogoRect`
124
+
125
+ attr_accessor :LogoUrl, :LogoImage, :LogoRect
126
+
127
+ def initialize(logourl=nil, logoimage=nil, logorect=nil)
128
+ @LogoUrl = logourl
129
+ @LogoImage = logoimage
130
+ @LogoRect = logorect
131
+ end
132
+
133
+ def deserialize(params)
134
+ @LogoUrl = params['LogoUrl']
135
+ @LogoImage = params['LogoImage']
136
+ unless params['LogoRect'].nil?
137
+ @LogoRect = LogoRect.new
138
+ @LogoRect.deserialize(params['LogoRect'])
139
+ end
140
+ end
141
+ end
142
+
143
+ # 输入框
144
+ class LogoRect < TencentCloud::Common::AbstractModel
145
+ # @param X: 左上角X坐标
146
+ # 注意:此字段可能返回 null,表示取不到有效值。
147
+ # @type X: Integer
148
+ # @param Y: 左上角Y坐标
149
+ # 注意:此字段可能返回 null,表示取不到有效值。
150
+ # @type Y: Integer
151
+ # @param Width: 方框宽度
152
+ # 注意:此字段可能返回 null,表示取不到有效值。
153
+ # @type Width: Integer
154
+ # @param Height: 方框高度
155
+ # 注意:此字段可能返回 null,表示取不到有效值。
156
+ # @type Height: Integer
157
+
158
+ attr_accessor :X, :Y, :Width, :Height
159
+
160
+ def initialize(x=nil, y=nil, width=nil, height=nil)
161
+ @X = x
162
+ @Y = y
163
+ @Width = width
164
+ @Height = height
165
+ end
166
+
167
+ def deserialize(params)
168
+ @X = params['X']
169
+ @Y = params['Y']
170
+ @Width = params['Width']
171
+ @Height = params['Height']
172
+ end
173
+ end
174
+
175
+ # 返回结果配置
176
+ class ResultConfig < TencentCloud::Common::AbstractModel
177
+ # @param Resolution: 生成图分辨率
178
+ # 支持生成以下不同分辨率的图片,对应1:1方图、3:4竖图、4:3横图三种尺寸规格,不传默认为"768:768"
179
+ # 取值:
180
+ # ● 768:768
181
+ # ● 768:1024
182
+ # ● 1024:768
183
+ # 注意:此字段可能返回 null,表示取不到有效值。
184
+ # @type Resolution: String
185
+
186
+ attr_accessor :Resolution
187
+
188
+ def initialize(resolution=nil)
189
+ @Resolution = resolution
190
+ end
191
+
192
+ def deserialize(params)
193
+ @Resolution = params['Resolution']
194
+ end
195
+ end
196
+
197
+ # TextToImage请求参数结构体
198
+ class TextToImageRequest < TencentCloud::Common::AbstractModel
199
+ # @param Prompt: 文本描述。
200
+ # 算法将根据输入的文本智能生成与之相关的图像。建议详细描述画面主体、细节、场景等,文本描述越丰富,生成效果越精美。
201
+ # 不能为空,推荐使用中文。最多可传512个 utf-8 字符。
202
+ # @type Prompt: String
203
+ # @param NegativePrompt: 反向文本描述。
204
+ # 用于一定程度上从反面引导模型生成的走向,减少生成结果中出现描述内容的可能,但不能完全杜绝。
205
+ # 推荐使用中文。最多可传512个 utf-8 字符。
206
+ # @type NegativePrompt: String
207
+ # @param Styles: 绘画风格。
208
+ # 请在 [智能文生图风格列表](https://cloud.tencent.com/document/product/1668/86249) 中选择期望的风格,传入风格编号。
209
+ # 推荐使用且只使用一种风格。不传默认使用201(日系动漫风格)。
210
+ # 如果想要探索风格列表之外的风格,也可以尝试在 Prompt 中输入其他的风格描述。
211
+ # @type Styles: Array
212
+ # @param ResultConfig: 生成图结果的配置,包括输出图片分辨率和尺寸等。
213
+ # @type ResultConfig: :class:`Tencentcloud::Aiart.v20221229.models.ResultConfig`
214
+ # @param LogoAdd: 为生成结果图添加标识的开关,默认为1。
215
+ # 1:添加标识。
216
+ # 0:不添加标识。
217
+ # 其他数值:默认按1处理。
218
+ # 建议您使用显著标识来提示结果图使用了 AI 绘画技术,是 AI 生成的图片。
219
+ # @type LogoAdd: Integer
220
+ # @param LogoParam: 标识内容设置。
221
+ # 默认在生成结果图右下角添加“图片由 AI 生成”字样,您可根据自身需要替换为其他的标识图片。
222
+ # @type LogoParam: :class:`Tencentcloud::Aiart.v20221229.models.LogoParam`
223
+
224
+ attr_accessor :Prompt, :NegativePrompt, :Styles, :ResultConfig, :LogoAdd, :LogoParam
225
+
226
+ def initialize(prompt=nil, negativeprompt=nil, styles=nil, resultconfig=nil, logoadd=nil, logoparam=nil)
227
+ @Prompt = prompt
228
+ @NegativePrompt = negativeprompt
229
+ @Styles = styles
230
+ @ResultConfig = resultconfig
231
+ @LogoAdd = logoadd
232
+ @LogoParam = logoparam
233
+ end
234
+
235
+ def deserialize(params)
236
+ @Prompt = params['Prompt']
237
+ @NegativePrompt = params['NegativePrompt']
238
+ @Styles = params['Styles']
239
+ unless params['ResultConfig'].nil?
240
+ @ResultConfig = ResultConfig.new
241
+ @ResultConfig.deserialize(params['ResultConfig'])
242
+ end
243
+ @LogoAdd = params['LogoAdd']
244
+ unless params['LogoParam'].nil?
245
+ @LogoParam = LogoParam.new
246
+ @LogoParam.deserialize(params['LogoParam'])
247
+ end
248
+ end
249
+ end
250
+
251
+ # TextToImage返回参数结构体
252
+ class TextToImageResponse < TencentCloud::Common::AbstractModel
253
+ # @param ResultImage: 返回的生成图 Base64 编码。
254
+ # @type ResultImage: String
255
+ # @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
256
+ # @type RequestId: String
257
+
258
+ attr_accessor :ResultImage, :RequestId
259
+
260
+ def initialize(resultimage=nil, requestid=nil)
261
+ @ResultImage = resultimage
262
+ @RequestId = requestid
263
+ end
264
+
265
+ def deserialize(params)
266
+ @ResultImage = params['ResultImage']
267
+ @RequestId = params['RequestId']
268
+ end
269
+ end
270
+
271
+ end
272
+ end
273
+ end
274
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tencentcloud-sdk-aiart
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.526
5
+ platform: ruby
6
+ authors:
7
+ - Tencent Cloud
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-03-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tencentcloud-sdk-common
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ description: Tencent Cloud Ruby SDK is the official software development kit, which
28
+ allows Ruby developers to write software that makes use of Tencent Cloud service
29
+ AIART.
30
+ email:
31
+ - tencentcloudapi@tencent.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - lib/v20221229/models.rb
37
+ - lib/v20221229/client.rb
38
+ - lib/tencentcloud-sdk-aiart.rb
39
+ - lib/VERSION
40
+ homepage: https://github.com/TencentCloud/tencentcloud-sdk-ruby
41
+ licenses:
42
+ - Apache-2.0
43
+ metadata:
44
+ source_code_uri: https://github.com/TencentCloud/tencentcloud-sdk-ruby/tencentcloud-sdk-aiart
45
+ changelog_uri: https://github.com/TencentCloud/tencentcloud-sdk-ruby/blob/master/CHANGELOG.md
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.0.14
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Tencent Cloud SDK for Ruby - AIART
66
+ test_files: []