# Path: model_card_toolkit/tfx/artifact.py
# class ModelCard(Artifact):
#   TYPE_NAME = 'ModelCard'
#   TYPE_ANNOTATION = Metrics
# def create_and_save_artifact(
#     artifact_name: str, artifact_uri: str,
#     store: mlmd.MetadataStore) -> metadata_store_pb2.Artifact:
# 
# Path: model_card_toolkit/tfx/executor.py
# _DEFAULT_MODEL_CARD_FILE_NAME = 'model_card.html'
# class Executor(BaseExecutor):
#   def _tfma_source(
#       self, input_dict: Dict[str,
#                              List[types.Artifact]]) -> Optional[src.TfmaSource]:
#   def _tfdv_source(
#       self, input_dict: Dict[str,
#                              List[types.Artifact]]) -> Optional[src.TfdvSource]:
#   def _model_source(
#       self,
#       input_dict: Dict[str, List[types.Artifact]]) -> Optional[src.ModelSource]:
#   def Do(self, input_dict: Dict[str, List[types.Artifact]],
#          output_dict: Dict[str, List[types.Artifact]],
#          exec_properties: Dict[str, Any]) -> None:


from typing import Any, List, Tuple, Optional
from model_card_toolkit.tfx import artifact
from model_card_toolkit.tfx import executor
from tfx import types
from tfx.dsl.components.base import executor_spec
from tfx.dsl.components.base.base_component import BaseComponent
from tfx.types import component_spec
from tfx.types import standard_artifacts
from tfx.types import standard_component_specs
  Component](https://www.tensorflow.org/tfx/guide/understanding_tfx_pipelines#component)
  that generates model cards.

  The model cards are written to a `ModelCard` artifact that can be fetched
  from the `outputs['model_card]'` property.

  Example:

  ```py
  context = InteractiveContext()
  ...
  mc_gen = ModelCardGenerator(
      statistics=statistics_gen.outputs['statistics'],
      evaluation=evaluator.outputs['evaluation'],
      pushed_model=pusher.outputs['pushed_model'],
      json="{'model_details': {'name': 'my_model'}}",
      template_io=[
          ('html/default_template.html.jinja', 'model_card.html'),
          ('md/default_template.md.jinja', 'model_card.md')
      ]
      )
  context.run(mc_gen)
  mc_artifact = mc_gen.outputs['model_card'].get()[0]
  mc_path = os.path.join(mc_artifact.uri, 'model_card', 'model_card.html')
  with open(mc_path) as f:
    mc_content = f.readlines()
  ```
  """

  SPEC_CLASS = ModelCardGeneratorSpec

# Path: model_card_toolkit/tfx/artifact.py
# class ModelCard(Artifact):
#   TYPE_NAME = 'ModelCard'
#   TYPE_ANNOTATION = Metrics
# def create_and_save_artifact(
#     artifact_name: str, artifact_uri: str,
#     store: mlmd.MetadataStore) -> metadata_store_pb2.Artifact:
# 
# Path: model_card_toolkit/tfx/executor.py
# _DEFAULT_MODEL_CARD_FILE_NAME = 'model_card.html'
# class Executor(BaseExecutor):
#   def _tfma_source(
#       self, input_dict: Dict[str,
#                              List[types.Artifact]]) -> Optional[src.TfmaSource]:
#   def _tfdv_source(
#       self, input_dict: Dict[str,
#                              List[types.Artifact]]) -> Optional[src.TfdvSource]:
#   def _model_source(
#       self,
#       input_dict: Dict[str, List[types.Artifact]]) -> Optional[src.ModelSource]:
#   def Do(self, input_dict: Dict[str, List[types.Artifact]],
#          output_dict: Dict[str, List[types.Artifact]],
#          exec_properties: Dict[str, Any]) -> None:


# Path: model_card_toolkit/tfx/component.py
from typing import Any, List, Tuple, Optional
from model_card_toolkit.tfx import artifact
from model_card_toolkit.tfx import executor
from tfx import types
from tfx.dsl.components.base import executor_spec
from tfx.dsl.components.base.base_component import BaseComponent
from tfx.types import component_spec
from tfx.types import standard_artifacts
from tfx.types import standard_component_specs

  Component](https://www.tensorflow.org/tfx/guide/understanding_tfx_pipelines#component)
  that generates model cards.

  The model cards are written to a `ModelCard` artifact that can be fetched
  from the `outputs['model_card]'` property.

  Example:

  ```py
  context = InteractiveContext()
  ...
  mc_gen = ModelCardGenerator(
      statistics=statistics_gen.outputs['statistics'],
      evaluation=evaluator.outputs['evaluation'],
      pushed_model=pusher.outputs['pushed_model'],
      json="{'model_details': {'name': 'my_model'}}",
      template_io=[
          ('html/default_template.html.jinja', 'model_card.html'),
          ('md/default_template.md.jinja', 'model_card.md')
      ]
      )
  context.run(mc_gen)
  mc_artifact = mc_gen.outputs['model_card'].get()[0]
  mc_path = os.path.join(mc_artifact.uri, 'model_card', 'model_card.html')
  with open(mc_path) as f:
    mc_content = f.readlines()
  ```
  """

  SPEC_CLASS = ModelCardGeneratorSpec

  EXECUTOR_SPEC = executor_spec.ExecutorClassSpec(executor.Executor)