44import torch
55from typing_extensions import override
66
7- from comfy_api .latest import IO , ComfyExtension
7+ from comfy_api .latest import IO , ComfyExtension , Input
88from comfy_api_nodes .apis .bytedance_api import (
99 RECOMMENDED_PRESETS ,
1010 RECOMMENDED_PRESETS_SEEDREAM_4 ,
@@ -235,7 +235,7 @@ def define_schema(cls):
235235 async def execute (
236236 cls ,
237237 model : str ,
238- image : torch . Tensor ,
238+ image : Input . Image ,
239239 prompt : str ,
240240 seed : int ,
241241 guidance_scale : float ,
@@ -275,7 +275,7 @@ def define_schema(cls):
275275 inputs = [
276276 IO .Combo .Input (
277277 "model" ,
278- options = ["seedream-4-0-250828" ],
278+ options = ["seedream-4-5-251128" , "seedream-4- 0-250828" ],
279279 tooltip = "Model name" ,
280280 ),
281281 IO .String .Input (
@@ -300,7 +300,7 @@ def define_schema(cls):
300300 default = 2048 ,
301301 min = 1024 ,
302302 max = 4096 ,
303- step = 64 ,
303+ step = 8 ,
304304 tooltip = "Custom width for image. Value is working only if `size_preset` is set to `Custom`" ,
305305 optional = True ,
306306 ),
@@ -309,7 +309,7 @@ def define_schema(cls):
309309 default = 2048 ,
310310 min = 1024 ,
311311 max = 4096 ,
312- step = 64 ,
312+ step = 8 ,
313313 tooltip = "Custom height for image. Value is working only if `size_preset` is set to `Custom`" ,
314314 optional = True ,
315315 ),
@@ -373,7 +373,7 @@ async def execute(
373373 cls ,
374374 model : str ,
375375 prompt : str ,
376- image : torch . Tensor = None ,
376+ image : Input . Image | None = None ,
377377 size_preset : str = RECOMMENDED_PRESETS_SEEDREAM_4 [0 ][0 ],
378378 width : int = 2048 ,
379379 height : int = 2048 ,
@@ -396,6 +396,18 @@ async def execute(
396396 raise ValueError (
397397 f"Custom size out of range: { w } x{ h } . " "Both width and height must be between 1024 and 4096 pixels."
398398 )
399+ out_num_pixels = w * h
400+ mp_provided = out_num_pixels / 1_000_000.0
401+ if "seedream-4-5" in model and out_num_pixels < 3686400 :
402+ raise ValueError (
403+ f"Minimum image resolution that Seedream 4.5 can generate is 3.68MP, "
404+ f"but { mp_provided :.2f} MP provided."
405+ )
406+ if "seedream-4-0" in model and out_num_pixels < 921600 :
407+ raise ValueError (
408+ f"Minimum image resolution that the selected model can generate is 0.92MP, "
409+ f"but { mp_provided :.2f} MP provided."
410+ )
399411 n_input_images = get_number_of_images (image ) if image is not None else 0
400412 if n_input_images > 10 :
401413 raise ValueError (f"Maximum of 10 reference images are supported, but { n_input_images } received." )
@@ -626,7 +638,7 @@ async def execute(
626638 cls ,
627639 model : str ,
628640 prompt : str ,
629- image : torch . Tensor ,
641+ image : Input . Image ,
630642 resolution : str ,
631643 aspect_ratio : str ,
632644 duration : int ,
@@ -748,8 +760,8 @@ async def execute(
748760 cls ,
749761 model : str ,
750762 prompt : str ,
751- first_frame : torch . Tensor ,
752- last_frame : torch . Tensor ,
763+ first_frame : Input . Image ,
764+ last_frame : Input . Image ,
753765 resolution : str ,
754766 aspect_ratio : str ,
755767 duration : int ,
@@ -871,7 +883,7 @@ async def execute(
871883 cls ,
872884 model : str ,
873885 prompt : str ,
874- images : torch . Tensor ,
886+ images : Input . Image ,
875887 resolution : str ,
876888 aspect_ratio : str ,
877889 duration : int ,
0 commit comments