code: def load_kfp_yaml_container_component(
      path: str,
  ) -> Callable[..., base_component.BaseComponent]:
      """Creates a container-based component from a Kubeflow component spec.
  
      See
      https://www.kubeflow.org/docs/pipelines/reference/component-spec/
  
      Example:
        component = load_kfp_yaml_container_component(
          "kfp_pipelines_root/components/datasets/Chicago_Taxi_Trips/component.yaml"
        )
  
      Args:
        path: local file path of a Kubeflow Pipelines component YAML file.
  
      Returns:
        Container component that can be instantiated in a TFX pipeline.
      """
      with open(path) as component_file:
          data = yaml.load(component_file, Loader=yaml.SafeLoader)
      _convert_target_fields_to_kv_pair(data)
      component_spec = json_format.ParseDict(
          data, kfp_component_spec_pb2.ComponentSpec()
      )
      container = component_spec.implementation.container
      command = list(
          map(_get_command_line_argument_type, container.command)
      ) + list(map(_get_command_line_argument_type, container.args))
      # TODO(ericlege): Support classname to class translation in inputs.type
      inputs = {
          item.name: standard_artifacts.String
          for item in component_spec.inputs
      }
      outputs = {
          item.name: standard_artifacts.String
          for item in component_spec.outputs
      }
      parameters = {}
      return container_component.create_container_component(
          name=component_spec.name,
          image=container.image,
          command=command,
          inputs=inputs,
          outputs=outputs,
          parameters=parameters,
      )
  
file_path: tfx/tfx/extensions/experimental/kfp_compatibility/kfp_container_component.py
imports: from typing import Any, Callable, Dict
  from tfx.dsl.component.experimental import container_component
  from tfx.dsl.component.experimental import placeholders
  from tfx.dsl.components.base import base_component
  from tfx.extensions.experimental.kfp_compatibility.proto import kfp_component_spec_pb2
  from tfx.types import standard_artifacts
  import yaml
  from google.protobuf import json_format
label_desc: Use image node_id 1 for calling a global function with example usage: load_kfp_yaml_container_component(path) and returns: container_component