bizyengine 1.2.68__py3-none-any.whl → 1.2.69__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.
- bizyengine/bizyair_extras/__init__.py +1 -5
- bizyengine/bizyair_extras/third_party_api/__init__.py +15 -0
- bizyengine/bizyair_extras/third_party_api/nodes_doubao.py +404 -0
- bizyengine/bizyair_extras/third_party_api/nodes_flux.py +173 -0
- bizyengine/bizyair_extras/third_party_api/nodes_gemini.py +403 -0
- bizyengine/bizyair_extras/third_party_api/nodes_gpt.py +101 -0
- bizyengine/bizyair_extras/third_party_api/nodes_hailuo.py +115 -0
- bizyengine/bizyair_extras/third_party_api/nodes_kling.py +404 -0
- bizyengine/bizyair_extras/third_party_api/nodes_sora.py +218 -0
- bizyengine/bizyair_extras/third_party_api/nodes_veo3.py +193 -0
- bizyengine/bizyair_extras/third_party_api/nodes_wan_api.py +198 -0
- bizyengine/bizyair_extras/third_party_api/trd_nodes_base.py +182 -0
- bizyengine/core/__init__.py +1 -0
- bizyengine/version.txt +1 -1
- {bizyengine-1.2.68.dist-info → bizyengine-1.2.69.dist-info}/METADATA +2 -2
- {bizyengine-1.2.68.dist-info → bizyengine-1.2.69.dist-info}/RECORD +18 -12
- bizyengine/bizyair_extras/nodes_gemini.py +0 -605
- bizyengine/bizyair_extras/nodes_seedream.py +0 -192
- bizyengine/bizyair_extras/nodes_sora2.py +0 -217
- bizyengine/bizyair_extras/nodes_veo3.py +0 -294
- bizyengine/bizyair_extras/nodes_wan_api.py +0 -299
- {bizyengine-1.2.68.dist-info → bizyengine-1.2.69.dist-info}/WHEEL +0 -0
- {bizyengine-1.2.68.dist-info → bizyengine-1.2.69.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
from bizyairsdk import tensor_to_bytesio
|
|
2
|
+
|
|
3
|
+
from .trd_nodes_base import BizyAirTrdApiBaseNode
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Kling_2_1_T2V_API(BizyAirTrdApiBaseNode):
|
|
7
|
+
NODE_DISPLAY_NAME = "Kling 2.1 Text To Video"
|
|
8
|
+
RETURN_TYPES = ("VIDEO",)
|
|
9
|
+
RETURN_NAMES = ("video",)
|
|
10
|
+
CATEGORY = "☁️BizyAir/External APIs/Kling"
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def INPUT_TYPES(cls):
|
|
14
|
+
return {
|
|
15
|
+
"required": {
|
|
16
|
+
"prompt": (
|
|
17
|
+
"STRING",
|
|
18
|
+
{
|
|
19
|
+
"multiline": True,
|
|
20
|
+
"default": "",
|
|
21
|
+
},
|
|
22
|
+
),
|
|
23
|
+
"negative_prompt": (
|
|
24
|
+
"STRING",
|
|
25
|
+
{
|
|
26
|
+
"multiline": True,
|
|
27
|
+
"default": "",
|
|
28
|
+
},
|
|
29
|
+
),
|
|
30
|
+
"model_name": (["kling-v2-1-master"], {"default": "kling-v2-1-master"}),
|
|
31
|
+
"duration": ([5, 10], {"default": 5}),
|
|
32
|
+
"aspect_ratio": (["16:9", "9:16", "1:1"], {"default": "16:9"}),
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
37
|
+
model = kwargs.get("model_name", "kling-v2-1-master")
|
|
38
|
+
prompt = kwargs.get("prompt", "")
|
|
39
|
+
negative_prompt = kwargs.get("negative_prompt", "")
|
|
40
|
+
duration = kwargs.get("duration", 5)
|
|
41
|
+
aspect_ratio = kwargs.get("aspect_ratio", "16:9")
|
|
42
|
+
if prompt is None or prompt.strip() == "":
|
|
43
|
+
raise ValueError("Prompt is required")
|
|
44
|
+
if len(prompt) > 2500 or len(negative_prompt) > 2500:
|
|
45
|
+
raise ValueError(
|
|
46
|
+
"Prompt and negative prompt must be less than 2500 characters"
|
|
47
|
+
)
|
|
48
|
+
data = {
|
|
49
|
+
"model_name": model,
|
|
50
|
+
"negative_prompt": negative_prompt,
|
|
51
|
+
"duration": duration,
|
|
52
|
+
"aspect_ratio": aspect_ratio,
|
|
53
|
+
"prompt": prompt,
|
|
54
|
+
}
|
|
55
|
+
return data, "kling-v2-1"
|
|
56
|
+
|
|
57
|
+
def handle_outputs(self, outputs):
|
|
58
|
+
return (outputs[0][0],)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class Kling_2_1_I2V_API(BizyAirTrdApiBaseNode):
|
|
62
|
+
NODE_DISPLAY_NAME = "Kling 2.1 Image To Video"
|
|
63
|
+
RETURN_TYPES = ("VIDEO",)
|
|
64
|
+
RETURN_NAMES = ("video",)
|
|
65
|
+
CATEGORY = "☁️BizyAir/External APIs/Kling"
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def INPUT_TYPES(cls):
|
|
69
|
+
return {
|
|
70
|
+
"required": {
|
|
71
|
+
"first_frame_image": ("IMAGE", {"tooltip": "首帧图片"}),
|
|
72
|
+
"prompt": (
|
|
73
|
+
"STRING",
|
|
74
|
+
{
|
|
75
|
+
"multiline": True,
|
|
76
|
+
"default": "",
|
|
77
|
+
},
|
|
78
|
+
),
|
|
79
|
+
"negative_prompt": (
|
|
80
|
+
"STRING",
|
|
81
|
+
{
|
|
82
|
+
"multiline": True,
|
|
83
|
+
"default": "",
|
|
84
|
+
},
|
|
85
|
+
),
|
|
86
|
+
"model_name": (
|
|
87
|
+
["kling-v2-1-std", "kling-v2-1-pro", "kling-v2-1-master"],
|
|
88
|
+
{"default": "kling-v2-1-std"},
|
|
89
|
+
),
|
|
90
|
+
"duration": ([5, 10], {"default": 5}),
|
|
91
|
+
"aspect_ratio": (["16:9", "9:16", "1:1"], {"default": "16:9"}),
|
|
92
|
+
},
|
|
93
|
+
"optional": {
|
|
94
|
+
"last_frame_image": ("IMAGE", {"tooltip": "末帧图片,只有pro支持"}),
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
99
|
+
model = kwargs.get("model_name", "kling-v2-1-std")
|
|
100
|
+
prompt = kwargs.get("prompt", "")
|
|
101
|
+
negative_prompt = kwargs.get("negative_prompt", "")
|
|
102
|
+
duration = kwargs.get("duration", 5)
|
|
103
|
+
aspect_ratio = kwargs.get("aspect_ratio", "16:9")
|
|
104
|
+
first_frame_image = kwargs.get("first_frame_image", None)
|
|
105
|
+
last_frame_image = kwargs.get("last_frame_image", None)
|
|
106
|
+
if first_frame_image is None:
|
|
107
|
+
raise ValueError("First frame image is required")
|
|
108
|
+
if len(prompt) > 2500 or len(negative_prompt) > 2500:
|
|
109
|
+
raise ValueError(
|
|
110
|
+
"Prompt and negative prompt must be less than 2500 characters"
|
|
111
|
+
)
|
|
112
|
+
# 上传图片
|
|
113
|
+
url = self.upload_file(
|
|
114
|
+
tensor_to_bytesio(image=first_frame_image, total_pixels=4096 * 4096),
|
|
115
|
+
f"{prompt_id}_first.png",
|
|
116
|
+
headers,
|
|
117
|
+
)
|
|
118
|
+
data = {
|
|
119
|
+
"model_name": model,
|
|
120
|
+
"prompt": prompt,
|
|
121
|
+
"negative_prompt": negative_prompt,
|
|
122
|
+
"first_frame_image": url,
|
|
123
|
+
"duration": duration,
|
|
124
|
+
"aspect_ratio": aspect_ratio,
|
|
125
|
+
}
|
|
126
|
+
if last_frame_image is not None:
|
|
127
|
+
last_frame_image_url = self.upload_file(
|
|
128
|
+
tensor_to_bytesio(image=last_frame_image, total_pixels=4096 * 4096),
|
|
129
|
+
f"{prompt_id}_last.png",
|
|
130
|
+
headers,
|
|
131
|
+
)
|
|
132
|
+
data["last_frame_image"] = last_frame_image_url
|
|
133
|
+
return data, "kling-v2-1"
|
|
134
|
+
|
|
135
|
+
def handle_outputs(self, outputs):
|
|
136
|
+
return (outputs[0][0],)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# class Kling_2_1_PRO_I2V_API(BizyAirTrdApiBaseNode):
|
|
140
|
+
# NODE_DISPLAY_NAME = "Kling 2.1 Pro Image To Video"
|
|
141
|
+
# RETURN_TYPES = ("VIDEO",)
|
|
142
|
+
# RETURN_NAMES = ("video",)
|
|
143
|
+
# CATEGORY = "☁️BizyAir/External APIs/Kling"
|
|
144
|
+
|
|
145
|
+
# @classmethod
|
|
146
|
+
# def INPUT_TYPES(cls):
|
|
147
|
+
# return {
|
|
148
|
+
# "required": {
|
|
149
|
+
# "first_frame_image": ("IMAGE", {"tooltip": "首帧图片"}),
|
|
150
|
+
# "prompt": (
|
|
151
|
+
# "STRING",
|
|
152
|
+
# {
|
|
153
|
+
# "multiline": True,
|
|
154
|
+
# "default": "",
|
|
155
|
+
# },
|
|
156
|
+
# ),
|
|
157
|
+
# "negative_prompt": (
|
|
158
|
+
# "STRING",
|
|
159
|
+
# {
|
|
160
|
+
# "multiline": True,
|
|
161
|
+
# "default": "",
|
|
162
|
+
# },
|
|
163
|
+
# ),
|
|
164
|
+
# "model_name": (["kling-v2-1", "kling-v2-1-master"], {"default": "kling-v2-1"}),
|
|
165
|
+
# "duration": ([5, 10], {"default": 5}),
|
|
166
|
+
# "aspect_ratio": (["16:9", "9:16", "1:1"], {"default": "16:9"}),
|
|
167
|
+
# },
|
|
168
|
+
# "optional": {
|
|
169
|
+
# "last_frame_image": ("IMAGE", {"tooltip": "末帧图片"}),
|
|
170
|
+
# },
|
|
171
|
+
# }
|
|
172
|
+
|
|
173
|
+
# def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
174
|
+
# model = kwargs.get("model_name", "kling-v2-1")
|
|
175
|
+
# prompt = kwargs.get("prompt", "")
|
|
176
|
+
# negative_prompt = kwargs.get("negative_prompt", "")
|
|
177
|
+
# duration = kwargs.get("duration", 5)
|
|
178
|
+
# aspect_ratio = kwargs.get("aspect_ratio", "16:9")
|
|
179
|
+
# first_frame_image = kwargs.get("first_frame_image", None)
|
|
180
|
+
# last_frame_image = kwargs.get("last_frame_image", None)
|
|
181
|
+
# if first_frame_image is None:
|
|
182
|
+
# raise ValueError("First frame image is required")
|
|
183
|
+
# if len(prompt) > 2500 or len(negative_prompt) > 2500:
|
|
184
|
+
# raise ValueError("Prompt and negative prompt must be less than 2500 characters")
|
|
185
|
+
# # 上传图片
|
|
186
|
+
# first_frame_image_url = self.upload_file(
|
|
187
|
+
# tensor_to_bytesio(image=first_frame_image, total_pixels=4096 * 4096),
|
|
188
|
+
# f"{prompt_id}_first.png",
|
|
189
|
+
# headers,
|
|
190
|
+
# )
|
|
191
|
+
# data = {
|
|
192
|
+
# "model_name": model,
|
|
193
|
+
# "prompt": prompt,
|
|
194
|
+
# "negative_prompt": negative_prompt,
|
|
195
|
+
# "first_frame_image": first_frame_image_url,
|
|
196
|
+
# "duration": duration,
|
|
197
|
+
# "aspect_ratio": aspect_ratio,
|
|
198
|
+
# }
|
|
199
|
+
# if model == "kling-v2-1":
|
|
200
|
+
# data["mode"] = "pro"
|
|
201
|
+
# if last_frame_image is not None:
|
|
202
|
+
# last_frame_image_url = self.upload_file(
|
|
203
|
+
# tensor_to_bytesio(image=last_frame_image, total_pixels=4096 * 4096),
|
|
204
|
+
# f"{prompt_id}_last.png",
|
|
205
|
+
# headers,
|
|
206
|
+
# )
|
|
207
|
+
# data["last_frame_image"] = last_frame_image_url
|
|
208
|
+
# return data, model
|
|
209
|
+
|
|
210
|
+
# def handle_outputs(self, outputs):
|
|
211
|
+
# return (outputs[0][0],)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class Kling_2_5_I2V_API(BizyAirTrdApiBaseNode):
|
|
215
|
+
NODE_DISPLAY_NAME = "Kling 2.5 Image To Video"
|
|
216
|
+
RETURN_TYPES = ("VIDEO",)
|
|
217
|
+
RETURN_NAMES = ("video",)
|
|
218
|
+
CATEGORY = "☁️BizyAir/External APIs/Kling"
|
|
219
|
+
|
|
220
|
+
@classmethod
|
|
221
|
+
def INPUT_TYPES(cls):
|
|
222
|
+
return {
|
|
223
|
+
"required": {
|
|
224
|
+
"first_frame_image": ("IMAGE", {"tooltip": "首帧图片"}),
|
|
225
|
+
"prompt": (
|
|
226
|
+
"STRING",
|
|
227
|
+
{
|
|
228
|
+
"multiline": True,
|
|
229
|
+
"default": "",
|
|
230
|
+
},
|
|
231
|
+
),
|
|
232
|
+
"negative_prompt": (
|
|
233
|
+
"STRING",
|
|
234
|
+
{
|
|
235
|
+
"multiline": True,
|
|
236
|
+
"default": "",
|
|
237
|
+
},
|
|
238
|
+
),
|
|
239
|
+
"model_name": (["kling-v2-5-turbo"], {"default": "kling-v2-5-turbo"}),
|
|
240
|
+
"duration": ([5, 10], {"default": 5}),
|
|
241
|
+
},
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
245
|
+
model = kwargs.get("model_name", "kling-v2-5-turbo")
|
|
246
|
+
prompt = kwargs.get("prompt", "")
|
|
247
|
+
negative_prompt = kwargs.get("negative_prompt", "")
|
|
248
|
+
duration = kwargs.get("duration", 5)
|
|
249
|
+
first_frame_image = kwargs.get("first_frame_image", None)
|
|
250
|
+
if first_frame_image is None:
|
|
251
|
+
raise ValueError("First frame image is required")
|
|
252
|
+
if len(prompt) > 2500 or len(negative_prompt) > 2500:
|
|
253
|
+
raise ValueError(
|
|
254
|
+
"Prompt and negative prompt must be less than 2500 characters"
|
|
255
|
+
)
|
|
256
|
+
# 上传图片
|
|
257
|
+
url = self.upload_file(
|
|
258
|
+
tensor_to_bytesio(image=first_frame_image, total_pixels=4096 * 4096),
|
|
259
|
+
f"{prompt_id}.png",
|
|
260
|
+
headers,
|
|
261
|
+
)
|
|
262
|
+
data = {
|
|
263
|
+
"model_name": model,
|
|
264
|
+
"prompt": prompt,
|
|
265
|
+
"negative_prompt": negative_prompt,
|
|
266
|
+
"duration": duration,
|
|
267
|
+
"first_frame_image": url,
|
|
268
|
+
}
|
|
269
|
+
return data, "kling-v2-5"
|
|
270
|
+
|
|
271
|
+
def handle_outputs(self, outputs):
|
|
272
|
+
return (outputs[0][0],)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class Kling_2_T2I_API(BizyAirTrdApiBaseNode):
|
|
276
|
+
NODE_DISPLAY_NAME = "Kling 2 Text To Image"
|
|
277
|
+
RETURN_TYPES = ("IMAGE",)
|
|
278
|
+
RETURN_NAMES = ("images",)
|
|
279
|
+
CATEGORY = "☁️BizyAir/External APIs/Kling"
|
|
280
|
+
|
|
281
|
+
@classmethod
|
|
282
|
+
def INPUT_TYPES(cls):
|
|
283
|
+
return {
|
|
284
|
+
"required": {
|
|
285
|
+
"prompt": (
|
|
286
|
+
"STRING",
|
|
287
|
+
{
|
|
288
|
+
"multiline": True,
|
|
289
|
+
"default": "",
|
|
290
|
+
},
|
|
291
|
+
),
|
|
292
|
+
"negative_prompt": (
|
|
293
|
+
"STRING",
|
|
294
|
+
{
|
|
295
|
+
"multiline": True,
|
|
296
|
+
"default": "",
|
|
297
|
+
},
|
|
298
|
+
),
|
|
299
|
+
"model_name": (["kling-v2"], {"default": "kling-v2"}),
|
|
300
|
+
"aspect_ratio": (
|
|
301
|
+
["16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3", "21:9"],
|
|
302
|
+
{"default": "16:9"},
|
|
303
|
+
),
|
|
304
|
+
"resolution": (["1K", "2K"], {"default": "1K"}),
|
|
305
|
+
"variants": ("INT", {"default": 1, "min": 1, "max": 9}),
|
|
306
|
+
"image_fidelity": (
|
|
307
|
+
"FLOAT",
|
|
308
|
+
{"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01},
|
|
309
|
+
),
|
|
310
|
+
},
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
314
|
+
model = kwargs.get("model_name", "kling-v2")
|
|
315
|
+
prompt = kwargs.get("prompt", "")
|
|
316
|
+
negative_prompt = kwargs.get("negative_prompt", "")
|
|
317
|
+
aspect_ratio = kwargs.get("aspect_ratio", "16:9")
|
|
318
|
+
resolution = kwargs.get("resolution", "1K").lower()
|
|
319
|
+
variants = kwargs.get("variants", 1)
|
|
320
|
+
image_fidelity = kwargs.get("image_fidelity", 0.5)
|
|
321
|
+
if len(prompt) > 2500 or len(negative_prompt) > 2500:
|
|
322
|
+
raise ValueError(
|
|
323
|
+
"Prompt and negative prompt must be less than 2500 characters"
|
|
324
|
+
)
|
|
325
|
+
data = {
|
|
326
|
+
"model_name": model,
|
|
327
|
+
"prompt": prompt,
|
|
328
|
+
"negative_prompt": negative_prompt,
|
|
329
|
+
"aspect_ratio": aspect_ratio,
|
|
330
|
+
"resolution": resolution,
|
|
331
|
+
"variants": variants,
|
|
332
|
+
"image_fidelity": image_fidelity,
|
|
333
|
+
}
|
|
334
|
+
return data, "kling-v2"
|
|
335
|
+
|
|
336
|
+
def handle_outputs(self, outputs):
|
|
337
|
+
images = self.combine_images(outputs[1])
|
|
338
|
+
return (images,)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
class Kling_2_I2I_API(BizyAirTrdApiBaseNode):
|
|
342
|
+
NODE_DISPLAY_NAME = "Kling 2 Image To Image"
|
|
343
|
+
RETURN_TYPES = ("IMAGE",)
|
|
344
|
+
RETURN_NAMES = ("images",)
|
|
345
|
+
CATEGORY = "☁️BizyAir/External APIs/Kling"
|
|
346
|
+
|
|
347
|
+
@classmethod
|
|
348
|
+
def INPUT_TYPES(cls):
|
|
349
|
+
return {
|
|
350
|
+
"required": {
|
|
351
|
+
"image": ("IMAGE", {"tooltip": "输入图片"}),
|
|
352
|
+
"prompt": (
|
|
353
|
+
"STRING",
|
|
354
|
+
{
|
|
355
|
+
"multiline": True,
|
|
356
|
+
"default": "",
|
|
357
|
+
},
|
|
358
|
+
),
|
|
359
|
+
"model_name": (["kling-v2"], {"default": "kling-v2"}),
|
|
360
|
+
"aspect_ratio": (
|
|
361
|
+
["16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3", "21:9"],
|
|
362
|
+
{"default": "16:9"},
|
|
363
|
+
),
|
|
364
|
+
"resolution": (["1K"], {"default": "1K"}),
|
|
365
|
+
"variants": ("INT", {"default": 1, "min": 1, "max": 9}),
|
|
366
|
+
"image_fidelity": (
|
|
367
|
+
"FLOAT",
|
|
368
|
+
{"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01},
|
|
369
|
+
),
|
|
370
|
+
},
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
374
|
+
model = kwargs.get("model_name", "kling-v2")
|
|
375
|
+
prompt = kwargs.get("prompt", "")
|
|
376
|
+
aspect_ratio = kwargs.get("aspect_ratio", "16:9")
|
|
377
|
+
resolution = kwargs.get("resolution", "1K").lower()
|
|
378
|
+
variants = kwargs.get("variants", 1)
|
|
379
|
+
image = kwargs.get("image", None)
|
|
380
|
+
image_fidelity = kwargs.get("image_fidelity", 0.5)
|
|
381
|
+
if image is None:
|
|
382
|
+
raise ValueError("Image is required")
|
|
383
|
+
if len(prompt) > 2500:
|
|
384
|
+
raise ValueError("Prompt must be less than 2500 characters")
|
|
385
|
+
# 上传图片
|
|
386
|
+
image_url = self.upload_file(
|
|
387
|
+
tensor_to_bytesio(image=image, total_pixels=4096 * 4096),
|
|
388
|
+
f"{prompt_id}.png",
|
|
389
|
+
headers,
|
|
390
|
+
)
|
|
391
|
+
data = {
|
|
392
|
+
"model_name": model,
|
|
393
|
+
"prompt": prompt,
|
|
394
|
+
"image": image_url,
|
|
395
|
+
"aspect_ratio": aspect_ratio,
|
|
396
|
+
"resolution": resolution,
|
|
397
|
+
"variants": variants,
|
|
398
|
+
"image_fidelity": image_fidelity,
|
|
399
|
+
}
|
|
400
|
+
return data, "kling-v2"
|
|
401
|
+
|
|
402
|
+
def handle_outputs(self, outputs):
|
|
403
|
+
images = self.combine_images(outputs[1])
|
|
404
|
+
return (images,)
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
from bizyairsdk import tensor_to_bytesio
|
|
2
|
+
|
|
3
|
+
from .trd_nodes_base import BizyAirTrdApiBaseNode
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Sora_V2_I2V_API(BizyAirTrdApiBaseNode):
|
|
7
|
+
NODE_DISPLAY_NAME = "Sora2 Image To Video"
|
|
8
|
+
RETURN_TYPES = ("VIDEO",)
|
|
9
|
+
RETURN_NAMES = ("video",)
|
|
10
|
+
CATEGORY = "☁️BizyAir/External APIs/Sora"
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def INPUT_TYPES(cls):
|
|
14
|
+
return {
|
|
15
|
+
"required": {
|
|
16
|
+
"prompt": (
|
|
17
|
+
"STRING",
|
|
18
|
+
{
|
|
19
|
+
"multiline": True,
|
|
20
|
+
"default": "",
|
|
21
|
+
},
|
|
22
|
+
),
|
|
23
|
+
"image": ("IMAGE", {"tooltip": "首帧图片"}),
|
|
24
|
+
"model": (["sora-2", "sora-2-pro"], {"default": "sora-2"}),
|
|
25
|
+
},
|
|
26
|
+
"optional": {
|
|
27
|
+
"aspect_ratio": (
|
|
28
|
+
["9:16", "16:9"],
|
|
29
|
+
{"default": "16:9"},
|
|
30
|
+
),
|
|
31
|
+
"duration": ([10, 15], {"default": 10}),
|
|
32
|
+
"size": (["small", "large"], {"default": "small"}),
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
37
|
+
# 参数
|
|
38
|
+
aspect_ratio = kwargs.get("aspect_ratio", "16:9")
|
|
39
|
+
duration = kwargs.get("duration", 10)
|
|
40
|
+
size = kwargs.get("size", "small")
|
|
41
|
+
model = kwargs.get("model", "sora-2")
|
|
42
|
+
prompt = kwargs.get("prompt", "")
|
|
43
|
+
image = kwargs.get("image", None)
|
|
44
|
+
if image is None:
|
|
45
|
+
raise ValueError("Image is required")
|
|
46
|
+
# 上传图片
|
|
47
|
+
url = self.upload_file(
|
|
48
|
+
tensor_to_bytesio(image=image, total_pixels=4096 * 4096),
|
|
49
|
+
f"{prompt_id}.png",
|
|
50
|
+
headers,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
data = {
|
|
54
|
+
"model": model,
|
|
55
|
+
"aspect_ratio": aspect_ratio,
|
|
56
|
+
"duration": duration,
|
|
57
|
+
"size": size,
|
|
58
|
+
"prompt": prompt,
|
|
59
|
+
"url": url,
|
|
60
|
+
}
|
|
61
|
+
return data, model
|
|
62
|
+
|
|
63
|
+
def handle_outputs(self, outputs):
|
|
64
|
+
return (outputs[0][0],)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class Sora_V2_T2V_API(BizyAirTrdApiBaseNode):
|
|
68
|
+
NODE_DISPLAY_NAME = "Sora2 Text To Video"
|
|
69
|
+
RETURN_TYPES = ("VIDEO",)
|
|
70
|
+
RETURN_NAMES = ("video",)
|
|
71
|
+
CATEGORY = "☁️BizyAir/External APIs/Sora"
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def INPUT_TYPES(cls):
|
|
75
|
+
return {
|
|
76
|
+
"required": {
|
|
77
|
+
"prompt": (
|
|
78
|
+
"STRING",
|
|
79
|
+
{
|
|
80
|
+
"multiline": True,
|
|
81
|
+
"default": "",
|
|
82
|
+
},
|
|
83
|
+
),
|
|
84
|
+
"model": (["sora-2", "sora-2-pro"], {"default": "sora-2"}),
|
|
85
|
+
},
|
|
86
|
+
"optional": {
|
|
87
|
+
"aspect_ratio": (
|
|
88
|
+
["9:16", "16:9"],
|
|
89
|
+
{"default": "16:9"},
|
|
90
|
+
),
|
|
91
|
+
"duration": ([10, 15], {"default": 10}),
|
|
92
|
+
"size": (["small", "large"], {"default": "small"}),
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
97
|
+
model = kwargs.get("model", "sora-2")
|
|
98
|
+
duration = kwargs.get("duration", 10)
|
|
99
|
+
aspect_ratio = kwargs.get("aspect_ratio", "16:9")
|
|
100
|
+
size = kwargs.get("size", "small")
|
|
101
|
+
prompt = kwargs.get("prompt", "")
|
|
102
|
+
data = {
|
|
103
|
+
"model": model,
|
|
104
|
+
"duration": duration,
|
|
105
|
+
"size": size,
|
|
106
|
+
"prompt": prompt,
|
|
107
|
+
"aspect_ratio": aspect_ratio,
|
|
108
|
+
}
|
|
109
|
+
return data, model
|
|
110
|
+
|
|
111
|
+
def handle_outputs(self, outputs):
|
|
112
|
+
return (outputs[0][0],)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# class Sora_V2_PRO_I2V_API(BizyAirTrdApiBaseNode):
|
|
116
|
+
# NODE_DISPLAY_NAME = "Sora2 Pro Image To Video"
|
|
117
|
+
# RETURN_TYPES = ("VIDEO",)
|
|
118
|
+
# RETURN_NAMES = ("video",)
|
|
119
|
+
# CATEGORY = "☁️BizyAir/External APIs/Sora"
|
|
120
|
+
|
|
121
|
+
# @classmethod
|
|
122
|
+
# def INPUT_TYPES(cls):
|
|
123
|
+
# return {
|
|
124
|
+
# "required": {
|
|
125
|
+
# "prompt": (
|
|
126
|
+
# "STRING",
|
|
127
|
+
# {
|
|
128
|
+
# "multiline": True,
|
|
129
|
+
# "default": "",
|
|
130
|
+
# },
|
|
131
|
+
# ),
|
|
132
|
+
# "image": ("IMAGE", {"tooltip": "首帧图片"}),
|
|
133
|
+
# "model": (["sora-2-pro"], {"default": "sora-2-pro"}),
|
|
134
|
+
# },
|
|
135
|
+
# "optional": {
|
|
136
|
+
# "aspect_ratio": (
|
|
137
|
+
# ["9:16", "16:9"],
|
|
138
|
+
# {"default": "16:9"},
|
|
139
|
+
# ),
|
|
140
|
+
# "duration": ([10, 15, 25], {"default": 10}),
|
|
141
|
+
# "size": (["standard", "high"], {"default": "standard"}),
|
|
142
|
+
# },
|
|
143
|
+
# }
|
|
144
|
+
|
|
145
|
+
# def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
146
|
+
# # 参数
|
|
147
|
+
# aspect_ratio = kwargs.get("aspect_ratio", "16:9")
|
|
148
|
+
# duration = kwargs.get("duration", 10)
|
|
149
|
+
# size = kwargs.get("size", "standard")
|
|
150
|
+
# model = kwargs.get("model", "sora-2-pro")
|
|
151
|
+
# prompt = kwargs.get("prompt", "")
|
|
152
|
+
# image = kwargs.get("image", None)
|
|
153
|
+
# if image is None:
|
|
154
|
+
# raise ValueError("Image is required")
|
|
155
|
+
# # 上传图片
|
|
156
|
+
# url = self.upload_file(
|
|
157
|
+
# tensor_to_bytesio(image=image, total_pixels=4096 * 4096),
|
|
158
|
+
# f"{prompt_id}.png",
|
|
159
|
+
# headers,
|
|
160
|
+
# )
|
|
161
|
+
|
|
162
|
+
# data = {
|
|
163
|
+
# "model": model,
|
|
164
|
+
# "aspect_ratio": aspect_ratio,
|
|
165
|
+
# "duration": duration,
|
|
166
|
+
# "size": size,
|
|
167
|
+
# "prompt": prompt,
|
|
168
|
+
# "url": url,
|
|
169
|
+
# }
|
|
170
|
+
# return data, model
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
# class Sora_V2_PRO_T2V_API(BizyAirTrdApiBaseNode):
|
|
174
|
+
# NODE_DISPLAY_NAME = "Sora2 Pro Text To Video"
|
|
175
|
+
# RETURN_TYPES = ("VIDEO",)
|
|
176
|
+
# RETURN_NAMES = ("video",)
|
|
177
|
+
# CATEGORY = "☁️BizyAir/External APIs/Sora"
|
|
178
|
+
|
|
179
|
+
# @classmethod
|
|
180
|
+
# def INPUT_TYPES(cls):
|
|
181
|
+
# return {
|
|
182
|
+
# "required": {
|
|
183
|
+
# "prompt": (
|
|
184
|
+
# "STRING",
|
|
185
|
+
# {
|
|
186
|
+
# "multiline": True,
|
|
187
|
+
# "default": "",
|
|
188
|
+
# },
|
|
189
|
+
# ),
|
|
190
|
+
# "model": (["sora-2-pro"], {"default": "sora-2-pro"}),
|
|
191
|
+
# },
|
|
192
|
+
# "optional": {
|
|
193
|
+
# "aspect_ratio": (
|
|
194
|
+
# ["9:16", "16:9"],
|
|
195
|
+
# {"default": "16:9"},
|
|
196
|
+
# ),
|
|
197
|
+
# "duration": ([10, 15, 25], {"default": 10}),
|
|
198
|
+
# "size": (["standard", "high"], {"default": "standard"}),
|
|
199
|
+
# },
|
|
200
|
+
# }
|
|
201
|
+
|
|
202
|
+
# def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
203
|
+
# model = kwargs.get("model", "sora-2-pro")
|
|
204
|
+
# duration = kwargs.get("duration", 10)
|
|
205
|
+
# aspect_ratio = kwargs.get("aspect_ratio", "16:9")
|
|
206
|
+
# size = kwargs.get("size", "standard")
|
|
207
|
+
# prompt = kwargs.get("prompt", "")
|
|
208
|
+
# data = {
|
|
209
|
+
# "model": model,
|
|
210
|
+
# "duration": duration,
|
|
211
|
+
# "size": size,
|
|
212
|
+
# "prompt": prompt,
|
|
213
|
+
# "aspect_ratio": aspect_ratio,
|
|
214
|
+
# }
|
|
215
|
+
# return data, model
|
|
216
|
+
|
|
217
|
+
# def handle_outputs(self, outputs):
|
|
218
|
+
# return (outputs[0][0],)
|