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