-
Notifications
You must be signed in to change notification settings - Fork 0
/
moveboards.py
42 lines (35 loc) · 1.15 KB
/
moveboards.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from invokeai.invocation_api import (
BaseInvocation,
InvocationContext,
invocation,
InputField,
ImageField,
ImageOutput,
BoardField,
)
from pydantic import BaseModel
@invocation(
"Move_Boards",
title="Move Image to Board",
tags=["image", "board"],
category="image",
version="0.1.0",
use_cache=False,
)
class MoveBoardsInvocation(BaseInvocation):
"""Move image to a different board"""
input_image: ImageField = InputField(
description="Input image to be moved"
)
output_board: BoardField = InputField(
description="Output board where images will be moved"
)
def invoke(self, context: InvocationContext) -> ImageOutput:
context._services.board_images.remove_image_from_board(self.input_image.image_name)
context._services.board_images.add_image_to_board(self.output_board.board_id, self.input_image.image_name)
image_dto = context.images.get_dto(self.input_image.image_name)
return ImageOutput(
image=ImageField(image_name=self.input_image.image_name),
width=image_dto.width,
height=image_dto.height,
)