bizyengine 1.2.64__py3-none-any.whl → 1.2.66__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/nodes_gemini.py +157 -0
- bizyengine/version.txt +1 -1
- {bizyengine-1.2.64.dist-info → bizyengine-1.2.66.dist-info}/METADATA +1 -1
- {bizyengine-1.2.64.dist-info → bizyengine-1.2.66.dist-info}/RECORD +6 -6
- {bizyengine-1.2.64.dist-info → bizyengine-1.2.66.dist-info}/WHEEL +0 -0
- {bizyengine-1.2.64.dist-info → bizyengine-1.2.66.dist-info}/top_level.txt +0 -0
|
@@ -306,3 +306,160 @@ class NanoBanana(BizyAirBaseNode):
|
|
|
306
306
|
except Exception as e:
|
|
307
307
|
logging.error(f"Gemini API error: {e}")
|
|
308
308
|
raise e
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
class NanoBananaPro(BizyAirBaseNode):
|
|
312
|
+
def __init__(self):
|
|
313
|
+
pass
|
|
314
|
+
|
|
315
|
+
@classmethod
|
|
316
|
+
def INPUT_TYPES(s):
|
|
317
|
+
return {
|
|
318
|
+
"required": {
|
|
319
|
+
"prompt": (
|
|
320
|
+
"STRING",
|
|
321
|
+
{
|
|
322
|
+
"multiline": True,
|
|
323
|
+
"default": "",
|
|
324
|
+
},
|
|
325
|
+
),
|
|
326
|
+
"operation": (
|
|
327
|
+
["generate", "edit", "style_transfer", "object_insertion"],
|
|
328
|
+
{
|
|
329
|
+
"default": "generate",
|
|
330
|
+
"tooltip": "Choose the type of image operation",
|
|
331
|
+
},
|
|
332
|
+
),
|
|
333
|
+
"temperature": (
|
|
334
|
+
"FLOAT",
|
|
335
|
+
{"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.05},
|
|
336
|
+
),
|
|
337
|
+
"top_p": (
|
|
338
|
+
"FLOAT",
|
|
339
|
+
{"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.05},
|
|
340
|
+
),
|
|
341
|
+
"seed": ("INT", {"default": 0, "min": 0, "max": 2147483647}),
|
|
342
|
+
"max_tokens": ("INT", {"default": 32768, "min": 1, "max": 32768}),
|
|
343
|
+
"aspect_ratio": (
|
|
344
|
+
["1:1", "16:9", "9:16", "4:3", "3:4"],
|
|
345
|
+
{"default": "1:1", "tooltip": "Output image aspect ratio"},
|
|
346
|
+
),
|
|
347
|
+
"resolution": (["1K", "2K", "4K"], {"default": "1K"}),
|
|
348
|
+
},
|
|
349
|
+
"optional": {
|
|
350
|
+
"images": ("IMAGE",),
|
|
351
|
+
"quality": (
|
|
352
|
+
["standard", "high"],
|
|
353
|
+
{"default": "high", "tooltip": "Image generation quality"},
|
|
354
|
+
),
|
|
355
|
+
"character_consistency": (
|
|
356
|
+
"BOOLEAN",
|
|
357
|
+
{
|
|
358
|
+
"default": True,
|
|
359
|
+
"tooltip": "Maintain character consistency across edits",
|
|
360
|
+
},
|
|
361
|
+
),
|
|
362
|
+
},
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
RETURN_TYPES = ("IMAGE", "STRING")
|
|
366
|
+
FUNCTION = "execute"
|
|
367
|
+
OUTPUT_NODE = False
|
|
368
|
+
CATEGORY = "☁️BizyAir/External APIs/Gemini"
|
|
369
|
+
|
|
370
|
+
def execute(
|
|
371
|
+
self,
|
|
372
|
+
prompt,
|
|
373
|
+
operation,
|
|
374
|
+
temperature,
|
|
375
|
+
top_p,
|
|
376
|
+
seed,
|
|
377
|
+
max_tokens,
|
|
378
|
+
aspect_ratio,
|
|
379
|
+
resolution,
|
|
380
|
+
images=None,
|
|
381
|
+
quality=None,
|
|
382
|
+
character_consistency=None,
|
|
383
|
+
**kwargs,
|
|
384
|
+
):
|
|
385
|
+
try:
|
|
386
|
+
url = f"{BIZYAIR_SERVER_ADDRESS}/proxy_inference/VertexAI/gemini-3-pro-image-preview"
|
|
387
|
+
extra_data = pop_api_key_and_prompt_id(kwargs)
|
|
388
|
+
|
|
389
|
+
if images is not None and len(images) > 14:
|
|
390
|
+
raise ValueError("Maximum number of images is 14")
|
|
391
|
+
parts = []
|
|
392
|
+
for batch_number, image in enumerate(images if images is not None else []):
|
|
393
|
+
if image is not None:
|
|
394
|
+
parts.append(
|
|
395
|
+
{
|
|
396
|
+
"inline_data": {
|
|
397
|
+
"mime_type": "image/png",
|
|
398
|
+
"data": tensor_to_base64_string(image),
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
prompt = build_prompt_for_operation(
|
|
404
|
+
prompt,
|
|
405
|
+
operation,
|
|
406
|
+
has_references=len(parts) > 0,
|
|
407
|
+
aspect_ratio=aspect_ratio,
|
|
408
|
+
character_consistency=character_consistency,
|
|
409
|
+
)
|
|
410
|
+
if quality == "high":
|
|
411
|
+
prompt += " Use the highest quality settings available."
|
|
412
|
+
parts.append({"text": prompt})
|
|
413
|
+
|
|
414
|
+
data = {
|
|
415
|
+
"contents": {
|
|
416
|
+
"parts": parts,
|
|
417
|
+
"role": "user",
|
|
418
|
+
},
|
|
419
|
+
"generationConfig": {
|
|
420
|
+
"seed": seed,
|
|
421
|
+
"responseModalities": ["TEXT", "IMAGE"],
|
|
422
|
+
"temperature": temperature,
|
|
423
|
+
"topP": top_p,
|
|
424
|
+
"maxOutputTokens": max_tokens,
|
|
425
|
+
"imageConfig": {
|
|
426
|
+
"imageSize": resolution,
|
|
427
|
+
"aspectRatio": aspect_ratio,
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
}
|
|
431
|
+
json_payload = json.dumps(data).encode("utf-8")
|
|
432
|
+
headers = client.headers(api_key=extra_data["api_key"])
|
|
433
|
+
headers["X-BIZYAIR-PROMPT-ID"] = extra_data[
|
|
434
|
+
"prompt_id"
|
|
435
|
+
] # 额外参数vertexai会拒绝,所以用请求头传
|
|
436
|
+
resp = client.send_request(
|
|
437
|
+
url=url,
|
|
438
|
+
data=json_payload,
|
|
439
|
+
headers=headers,
|
|
440
|
+
)
|
|
441
|
+
# 解析潜在错误
|
|
442
|
+
prompt_feedback = resp.get("promptFeedback", None)
|
|
443
|
+
if prompt_feedback:
|
|
444
|
+
logging.error(f"Response: {resp}")
|
|
445
|
+
raise ValueError(f"Prompt blocked: {prompt_feedback}")
|
|
446
|
+
if len(resp.get("candidates", [])) == 0:
|
|
447
|
+
logging.error(f"Response: {resp}")
|
|
448
|
+
raise ValueError("No candidates found in response")
|
|
449
|
+
if resp["candidates"][0]["finishReason"] != "STOP":
|
|
450
|
+
logging.error(f"Response: {resp}")
|
|
451
|
+
raise ValueError(
|
|
452
|
+
f"Erroneous finish reason: {resp['candidates'][0]['finishReason']}"
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
# 解析文本
|
|
456
|
+
text = get_text_from_response(resp)
|
|
457
|
+
|
|
458
|
+
# 解析base64图片
|
|
459
|
+
image = get_image_from_response(resp)
|
|
460
|
+
|
|
461
|
+
return (image, text)
|
|
462
|
+
|
|
463
|
+
except Exception as e:
|
|
464
|
+
logging.error(f"Gemini API error: {e}")
|
|
465
|
+
raise e
|
bizyengine/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.66
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bizyengine
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.66
|
|
4
4
|
Summary: [a/BizyAir](https://github.com/siliconflow/BizyAir) Comfy Nodes that can run in any environment.
|
|
5
5
|
Author-email: SiliconFlow <yaochi@siliconflow.cn>
|
|
6
6
|
Project-URL: Repository, https://github.com/siliconflow/BizyAir
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
bizyengine/__init__.py,sha256=GP9V-JM07fz7uv_qTB43QEA2rKdrVJxi5I7LRnn_3ZQ,914
|
|
2
|
-
bizyengine/version.txt,sha256=
|
|
2
|
+
bizyengine/version.txt,sha256=JfKoIMXW0UfH6cucqqNqD89qwq9gR_SqQ1Ky-4wtr3c,7
|
|
3
3
|
bizyengine/bizy_server/__init__.py,sha256=SP9oSblnPo4KQyh7yOGD26YCskFAcQHAZy04nQBNRIw,200
|
|
4
4
|
bizyengine/bizy_server/api_client.py,sha256=Z7G5IjaEqSJkF6nLLw2R3bpgBAOi5ClQiUbel6NMXmE,43932
|
|
5
5
|
bizyengine/bizy_server/errno.py,sha256=RIyvegX3lzpx_1L1q2XVvu3on0kvYgKiUQ8U3ZtyF68,16823
|
|
@@ -22,7 +22,7 @@ bizyengine/bizyair_extras/nodes_custom_sampler.py,sha256=NK-7sdcp8oxJisjTEFfBskk
|
|
|
22
22
|
bizyengine/bizyair_extras/nodes_dataset.py,sha256=htF0YZb_FHncLhLDEbJfNCVqJ6rvlo1ZLk7iY42Rylc,3440
|
|
23
23
|
bizyengine/bizyair_extras/nodes_differential_diffusion.py,sha256=nSrbD-w0XtrwktwzME5M0Vmi1sI7Z08AqwgymTdThqo,370
|
|
24
24
|
bizyengine/bizyair_extras/nodes_flux.py,sha256=ls94kGBuBNgW5c6uhG36iZLk1TTM2TIoTTcpERgEE5E,2683
|
|
25
|
-
bizyengine/bizyair_extras/nodes_gemini.py,sha256=
|
|
25
|
+
bizyengine/bizyair_extras/nodes_gemini.py,sha256=yMngTTCmgOV3lB4Wnqi1A-qSk4MFGGTBSbe0hK-o9QE,16097
|
|
26
26
|
bizyengine/bizyair_extras/nodes_hunyuan3d.py,sha256=dWHLeqX68N7zKnfDMzm9nutmCNtFT6-wwt7P5cPDu7Q,2058
|
|
27
27
|
bizyengine/bizyair_extras/nodes_image_utils.py,sha256=BldF_CKD2M01K8-SnG-QV86u3HZqFz_GP5GrCQ5CFDQ,2875
|
|
28
28
|
bizyengine/bizyair_extras/nodes_ip2p.py,sha256=GSEFJvrs4f2tv0xwYkWqc8uhsXrzAJVPvvwcw0gTjR0,619
|
|
@@ -97,7 +97,7 @@ bizyengine/misc/route_sam.py,sha256=-bMIR2QalfnszipGxSxvDAHGJa5gPSrjkYPb5baaRg4,
|
|
|
97
97
|
bizyengine/misc/segment_anything.py,sha256=wNKYwlYPMszfwj23524geFZJjZaG4eye65SGaUnh77I,8941
|
|
98
98
|
bizyengine/misc/supernode.py,sha256=STN9gaxfTSErH8OiHeZa47d8z-G9S0I7fXuJvHQOBFM,4532
|
|
99
99
|
bizyengine/misc/utils.py,sha256=nXXTPkj4WBvds4EWjI9c-ydeWwmXl8Vwrdu-4Fh62g8,12914
|
|
100
|
-
bizyengine-1.2.
|
|
101
|
-
bizyengine-1.2.
|
|
102
|
-
bizyengine-1.2.
|
|
103
|
-
bizyengine-1.2.
|
|
100
|
+
bizyengine-1.2.66.dist-info/METADATA,sha256=SV507-RvZb4rbAXDX8mWZ9Lp3n-6XK86OYaIqIEF524,735
|
|
101
|
+
bizyengine-1.2.66.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
102
|
+
bizyengine-1.2.66.dist-info/top_level.txt,sha256=2zapzqxX-we5cRyJkGf9bd5JinRtXp3-_uDI-xCAnc0,11
|
|
103
|
+
bizyengine-1.2.66.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|