File size: 1,763 Bytes
4bbc35a
 
 
 
 
 
 
 
 
 
 
 
 
73790f6
4bbc35a
 
 
 
 
73790f6
 
4bbc35a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73790f6
 
 
 
 
 
4bbc35a
 
 
 
 
 
73790f6
d32beda
 
 
 
73790f6
4bbc35a
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from typing import List

from diffusers.modular_pipelines import (
    ComponentSpec,
    InputParam,
    ModularPipelineBlocks,
    OutputParam,
    PipelineState,
)


class MyCustomBlock(ModularPipelineBlocks):
    """
    A custom block for inspect model info in your components manager
    """

    @property
    def description(self) -> str:
        """Description of the block."""
        return "Inspect your components manager"



    @property
    def inputs(self) -> List[InputParam]:
        """Define input parameters for your block."""
        return [
            # Example:
            # InputParam(
            #     "prompt",
            #     type_hint=str,
            #     required=True,
            #     description="Input prompt",
            #     metadata={"mellon": "textbox"},  # For Mellon UI
            # ),
        ]

    @property
    def intermediate_outputs(self) -> List[OutputParam]:
        """Define output parameters for your block."""
        return [
            # Example:
            OutputParam(
                "components_info",
                type_hint=str,
                description="model info in components manager ",
                metadata={"mellon": "text"},  # For Mellon UI
            ),
        ]

    def __call__(self, components, state: PipelineState) -> PipelineState:
        """Execute your block logic."""
        block_state = self.get_block_state(state)
        
        try:
            from modules.ModularDiffusers import components as manager
            result = repr(manager)
        except ImportError as e:
            result = f"Import error: {e}"
        block_state.components_info = result
        
        self.set_block_state(state, block_state)
        return components, state