InvokeAI/invokeai/app/services/invocation_services.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
2.1 KiB
Python
Raw Normal View History

2023-04-29 14:48:50 +00:00
# Copyright (c) 2022 Kyle Schouviller (https://github.com/kyle0654) and the InvokeAI Team
2023-05-21 10:24:37 +00:00
from logging import Logger
from invokeai.app.services.images import ImageService
from invokeai.backend import ModelManager
2023-03-03 06:02:00 +00:00
from .events import EventServiceBase
from .latent_storage import LatentsStorageBase
from .image_file_storage import ImageFileStorageBase
2023-03-11 22:00:00 +00:00
from .restoration_services import RestorationServices
from .invocation_queue import InvocationQueueABC
from .item_storage import ItemStorageABC
from .config import InvokeAISettings
2023-03-03 06:02:00 +00:00
class InvocationServices:
"""Services that can be used by invocations"""
2023-03-03 06:02:00 +00:00
events: EventServiceBase
latents: LatentsStorageBase
images: ImageFileStorageBase
queue: InvocationQueueABC
2023-03-11 22:00:00 +00:00
model_manager: ModelManager
restoration: RestorationServices
configuration: InvokeAISettings
images_new: ImageService
# NOTE: we must forward-declare any types that include invocations, since invocations can use services
graph_library: ItemStorageABC["LibraryGraph"]
2023-03-03 06:02:00 +00:00
graph_execution_manager: ItemStorageABC["GraphExecutionState"]
processor: "InvocationProcessorABC"
2023-03-03 06:02:00 +00:00
def __init__(
self,
model_manager: ModelManager,
events: EventServiceBase,
2023-05-21 10:24:37 +00:00
logger: Logger,
latents: LatentsStorageBase,
images: ImageFileStorageBase,
queue: InvocationQueueABC,
images_new: ImageService,
graph_library: ItemStorageABC["LibraryGraph"],
graph_execution_manager: ItemStorageABC["GraphExecutionState"],
processor: "InvocationProcessorABC",
restoration: RestorationServices,
configuration: InvokeAISettings=None,
):
self.model_manager = model_manager
self.events = events
2023-04-29 14:48:50 +00:00
self.logger = logger
self.latents = latents
self.images = images
self.queue = queue
self.images_new = images_new
self.graph_library = graph_library
self.graph_execution_manager = graph_execution_manager
self.processor = processor
2023-03-11 22:00:00 +00:00
self.restoration = restoration
self.configuration = configuration