52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
from .utils.shot_utils import get_image_input_types, create_image_payload, make_api_request, shot_by_image_api_url, PlacementType
|
|
|
|
|
|
class ShotByImageAutomaticNode:
|
|
@classmethod
|
|
def INPUT_TYPES(self):
|
|
input_types = get_image_input_types()
|
|
input_types["required"]["shot_size"] = ("STRING", {"default": "1000, 1000"})
|
|
return input_types
|
|
|
|
RETURN_TYPES = ("IMAGE", "IMAGE", "IMAGE", "IMAGE", "IMAGE", "IMAGE", "IMAGE")
|
|
RETURN_NAMES = (
|
|
"output_image_1",
|
|
"output_image_2",
|
|
"output_image_3",
|
|
"output_image_4",
|
|
"output_image_5",
|
|
"output_image_6",
|
|
"output_image_7",
|
|
)
|
|
CATEGORY = "API Nodes"
|
|
FUNCTION = "execute"
|
|
|
|
def __init__(self):
|
|
self.api_url = shot_by_image_api_url
|
|
|
|
def execute(
|
|
self,
|
|
image,
|
|
ref_image,
|
|
shot_size,
|
|
api_key,
|
|
sync=False,
|
|
enhance_ref_image=True,
|
|
ref_image_influence=1.0,
|
|
force_rmbg=False,
|
|
content_moderation=False,
|
|
):
|
|
payload = create_image_payload(
|
|
image,
|
|
ref_image,
|
|
api_key,
|
|
PlacementType.AUTOMATIC.value,
|
|
shot_size=shot_size,
|
|
sync=sync,
|
|
enhance_ref_image=enhance_ref_image,
|
|
ref_image_influence=ref_image_influence,
|
|
force_rmbg=force_rmbg,
|
|
content_moderation=content_moderation,
|
|
)
|
|
return make_api_request(self.api_url, payload, api_key, Placement_type = PlacementType.AUTOMATIC.value)
|