2022-12-01 05:33:20 +00:00
|
|
|
# Copyright (c) 2022 Kyle Schouviller (https://github.com/kyle0654)
|
2023-03-09 05:18:29 +00:00
|
|
|
from invokeai.backend import InvokeAIGeneratorFactory
|
2023-03-03 06:02:00 +00:00
|
|
|
|
|
|
|
from .events import EventServiceBase
|
|
|
|
from .image_storage import ImageStorageBase
|
2023-02-25 04:11:28 +00:00
|
|
|
from .invocation_queue import InvocationQueueABC
|
|
|
|
from .item_storage import ItemStorageABC
|
2022-12-01 05:33:20 +00:00
|
|
|
|
2023-03-03 06:02:00 +00:00
|
|
|
|
|
|
|
class InvocationServices:
|
2022-12-01 05:33:20 +00:00
|
|
|
"""Services that can be used by invocations"""
|
2023-03-03 06:02:00 +00:00
|
|
|
|
2023-03-09 05:18:29 +00:00
|
|
|
generator_factory: InvokeAIGeneratorFactory
|
2022-12-01 05:33:20 +00:00
|
|
|
events: EventServiceBase
|
|
|
|
images: ImageStorageBase
|
2023-02-25 04:11:28 +00:00
|
|
|
queue: InvocationQueueABC
|
|
|
|
|
|
|
|
# NOTE: we must forward-declare any types that include invocations, since invocations can use services
|
2023-03-03 06:02:00 +00:00
|
|
|
graph_execution_manager: ItemStorageABC["GraphExecutionState"]
|
|
|
|
processor: "InvocationProcessorABC"
|
2022-12-01 05:33:20 +00:00
|
|
|
|
2023-03-03 06:02:00 +00:00
|
|
|
def __init__(
|
2023-03-09 05:18:29 +00:00
|
|
|
self,
|
|
|
|
generator_factory: InvokeAIGeneratorFactory,
|
|
|
|
events: EventServiceBase,
|
|
|
|
images: ImageStorageBase,
|
|
|
|
queue: InvocationQueueABC,
|
|
|
|
graph_execution_manager: ItemStorageABC["GraphExecutionState"],
|
|
|
|
processor: "InvocationProcessorABC",
|
2022-12-01 05:33:20 +00:00
|
|
|
):
|
2023-03-09 05:18:29 +00:00
|
|
|
self.generator_factory = generator_factory
|
2022-12-01 05:33:20 +00:00
|
|
|
self.events = events
|
|
|
|
self.images = images
|
2023-02-25 04:11:28 +00:00
|
|
|
self.queue = queue
|
|
|
|
self.graph_execution_manager = graph_execution_manager
|
|
|
|
self.processor = processor
|