bizyengine 1.2.65__py3-none-any.whl → 1.2.67__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 +142 -2
- bizyengine/version.txt +1 -1
- {bizyengine-1.2.65.dist-info → bizyengine-1.2.67.dist-info}/METADATA +1 -1
- {bizyengine-1.2.65.dist-info → bizyengine-1.2.67.dist-info}/RECORD +6 -6
- {bizyengine-1.2.65.dist-info → bizyengine-1.2.67.dist-info}/WHEEL +0 -0
- {bizyengine-1.2.65.dist-info → bizyengine-1.2.67.dist-info}/top_level.txt +0 -0
|
@@ -386,10 +386,10 @@ class NanoBananaPro(BizyAirBaseNode):
|
|
|
386
386
|
url = f"{BIZYAIR_SERVER_ADDRESS}/proxy_inference/VertexAI/gemini-3-pro-image-preview"
|
|
387
387
|
extra_data = pop_api_key_and_prompt_id(kwargs)
|
|
388
388
|
|
|
389
|
-
if len(images) > 14:
|
|
389
|
+
if images is not None and len(images) > 14:
|
|
390
390
|
raise ValueError("Maximum number of images is 14")
|
|
391
391
|
parts = []
|
|
392
|
-
for batch_number, image in enumerate(images):
|
|
392
|
+
for batch_number, image in enumerate(images if images is not None else []):
|
|
393
393
|
if image is not None:
|
|
394
394
|
parts.append(
|
|
395
395
|
{
|
|
@@ -463,3 +463,143 @@ class NanoBananaPro(BizyAirBaseNode):
|
|
|
463
463
|
except Exception as e:
|
|
464
464
|
logging.error(f"Gemini API error: {e}")
|
|
465
465
|
raise e
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
class NanoBananaProOfficial(BizyAirBaseNode):
|
|
469
|
+
@classmethod
|
|
470
|
+
def INPUT_TYPES(s):
|
|
471
|
+
return {
|
|
472
|
+
"required": {
|
|
473
|
+
"prompt": (
|
|
474
|
+
"STRING",
|
|
475
|
+
{
|
|
476
|
+
"multiline": True,
|
|
477
|
+
"default": "",
|
|
478
|
+
},
|
|
479
|
+
),
|
|
480
|
+
"temperature": (
|
|
481
|
+
"FLOAT",
|
|
482
|
+
{"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.05},
|
|
483
|
+
),
|
|
484
|
+
"top_p": (
|
|
485
|
+
"FLOAT",
|
|
486
|
+
{"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.05},
|
|
487
|
+
),
|
|
488
|
+
"seed": ("INT", {"default": 0, "min": 0, "max": 2147483647}),
|
|
489
|
+
"max_tokens": ("INT", {"default": 32768, "min": 1, "max": 32768}),
|
|
490
|
+
"aspect_ratio": (
|
|
491
|
+
[
|
|
492
|
+
"1:1",
|
|
493
|
+
"2:3",
|
|
494
|
+
"3:2",
|
|
495
|
+
"3:4",
|
|
496
|
+
"4:3",
|
|
497
|
+
"4:5",
|
|
498
|
+
"5:4",
|
|
499
|
+
"9:16",
|
|
500
|
+
"16:9",
|
|
501
|
+
"21:9",
|
|
502
|
+
"auto",
|
|
503
|
+
],
|
|
504
|
+
{"default": "auto", "tooltip": "Output image aspect ratio"},
|
|
505
|
+
),
|
|
506
|
+
"resolution": (["1K", "2K", "4K", "auto"], {"default": "auto"}),
|
|
507
|
+
},
|
|
508
|
+
"optional": {
|
|
509
|
+
"images": ("IMAGE",),
|
|
510
|
+
},
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
RETURN_TYPES = ("IMAGE", "STRING")
|
|
514
|
+
FUNCTION = "execute"
|
|
515
|
+
OUTPUT_NODE = False
|
|
516
|
+
CATEGORY = "☁️BizyAir/External APIs/Gemini"
|
|
517
|
+
NODE_DISPLAY_NAME = "NanoBananaPro (Official Parameters)"
|
|
518
|
+
|
|
519
|
+
def execute(
|
|
520
|
+
self,
|
|
521
|
+
prompt,
|
|
522
|
+
temperature,
|
|
523
|
+
top_p,
|
|
524
|
+
seed,
|
|
525
|
+
max_tokens,
|
|
526
|
+
aspect_ratio,
|
|
527
|
+
resolution,
|
|
528
|
+
images=None,
|
|
529
|
+
**kwargs,
|
|
530
|
+
):
|
|
531
|
+
try:
|
|
532
|
+
url = f"{BIZYAIR_SERVER_ADDRESS}/proxy_inference/VertexAI/gemini-3-pro-image-preview"
|
|
533
|
+
extra_data = pop_api_key_and_prompt_id(kwargs)
|
|
534
|
+
|
|
535
|
+
if images is not None and len(images) > 14:
|
|
536
|
+
raise ValueError("Maximum number of images is 14")
|
|
537
|
+
parts = [{"text": prompt}]
|
|
538
|
+
for batch_number, image in enumerate(images if images is not None else []):
|
|
539
|
+
if image is not None:
|
|
540
|
+
parts.append(
|
|
541
|
+
{
|
|
542
|
+
"inline_data": {
|
|
543
|
+
"mime_type": "image/png",
|
|
544
|
+
"data": tensor_to_base64_string(image),
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
image_config = {}
|
|
550
|
+
if resolution != "auto":
|
|
551
|
+
image_config["imageSize"] = resolution
|
|
552
|
+
if aspect_ratio != "auto":
|
|
553
|
+
image_config["aspectRatio"] = aspect_ratio
|
|
554
|
+
generation_config = {
|
|
555
|
+
"seed": seed,
|
|
556
|
+
"responseModalities": ["TEXT", "IMAGE"],
|
|
557
|
+
"temperature": temperature,
|
|
558
|
+
"topP": top_p,
|
|
559
|
+
"maxOutputTokens": max_tokens,
|
|
560
|
+
}
|
|
561
|
+
if image_config != {}:
|
|
562
|
+
generation_config["imageConfig"] = image_config
|
|
563
|
+
logging.info(f"Generation config: {generation_config}")
|
|
564
|
+
data = {
|
|
565
|
+
"contents": {
|
|
566
|
+
"parts": parts,
|
|
567
|
+
"role": "user",
|
|
568
|
+
},
|
|
569
|
+
"generationConfig": generation_config,
|
|
570
|
+
}
|
|
571
|
+
json_payload = json.dumps(data).encode("utf-8")
|
|
572
|
+
headers = client.headers(api_key=extra_data["api_key"])
|
|
573
|
+
headers["X-BIZYAIR-PROMPT-ID"] = extra_data[
|
|
574
|
+
"prompt_id"
|
|
575
|
+
] # 额外参数vertexai会拒绝,所以用请求头传
|
|
576
|
+
resp = client.send_request(
|
|
577
|
+
url=url,
|
|
578
|
+
data=json_payload,
|
|
579
|
+
headers=headers,
|
|
580
|
+
)
|
|
581
|
+
# 解析潜在错误
|
|
582
|
+
prompt_feedback = resp.get("promptFeedback", None)
|
|
583
|
+
if prompt_feedback:
|
|
584
|
+
logging.error(f"Response: {resp}")
|
|
585
|
+
raise ValueError(f"Prompt blocked: {prompt_feedback}")
|
|
586
|
+
if len(resp.get("candidates", [])) == 0:
|
|
587
|
+
logging.error(f"Response: {resp}")
|
|
588
|
+
raise ValueError("No candidates found in response")
|
|
589
|
+
if resp["candidates"][0]["finishReason"] != "STOP":
|
|
590
|
+
logging.error(f"Response: {resp}")
|
|
591
|
+
raise ValueError(
|
|
592
|
+
f"Erroneous finish reason: {resp['candidates'][0]['finishReason']}"
|
|
593
|
+
)
|
|
594
|
+
|
|
595
|
+
# 解析文本
|
|
596
|
+
text = get_text_from_response(resp)
|
|
597
|
+
|
|
598
|
+
# 解析base64图片
|
|
599
|
+
image = get_image_from_response(resp)
|
|
600
|
+
|
|
601
|
+
return (image, text)
|
|
602
|
+
|
|
603
|
+
except Exception as e:
|
|
604
|
+
logging.error(f"Gemini API error: {e}")
|
|
605
|
+
raise e
|
bizyengine/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.67
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bizyengine
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.67
|
|
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=HO17D2oKn4i7o0xBaxcgdF_1EGXo3mJ-AFhW9WyJaYo,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=i6_YqG4n7aVdqVtDhMbNeP0SZqp21JYe1MBqISe5LPQ,21054
|
|
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.67.dist-info/METADATA,sha256=ws1b3lePVEyV62m-FLAO6M3irolR1ErxM6pR2Tarz88,735
|
|
101
|
+
bizyengine-1.2.67.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
102
|
+
bizyengine-1.2.67.dist-info/top_level.txt,sha256=2zapzqxX-we5cRyJkGf9bd5JinRtXp3-_uDI-xCAnc0,11
|
|
103
|
+
bizyengine-1.2.67.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|