# Path: model_card_toolkit/model_card.py
# class Owner(BaseModelCardField):
# class Version(BaseModelCardField):
# class License(BaseModelCardField):
# class Reference(BaseModelCardField):
# class Citation(BaseModelCardField):
# class ModelDetails(BaseModelCardField):
# class Graphic(BaseModelCardField):
# class GraphicsCollection(BaseModelCardField):
# class SensitiveData(BaseModelCardField):
# class Dataset(BaseModelCardField):
# class KeyVal(BaseModelCardField):
# class ModelParameters(BaseModelCardField):
# class ConfidenceInterval(BaseModelCardField):
# class PerformanceMetric(BaseModelCardField):
# class QuantitativeAnalysis(BaseModelCardField):
# class User(BaseModelCardField):
# class UseCase(BaseModelCardField):
# class Limitation(BaseModelCardField):
# class Tradeoff(BaseModelCardField):
# class Risk(BaseModelCardField):
# class Considerations(BaseModelCardField):
# class ModelCard(BaseModelCardField):
#   def to_json(self) -> str:
#   def from_json(self, json_dict: Dict[str, Any]) -> None:
#   def merge_from_json(self, json: Union[Dict[str, Any], str]) -> None:


import base64
import io
import logging
import attr
import matplotlib
import matplotlib.pyplot as plt
import tensorflow_model_analysis as tfma
from typing import Sequence, Tuple, Union, Optional
from model_card_toolkit import model_card as model_card_module
from tensorflow_metadata.proto.v0 import statistics_pb2


_COLOR_PALETTE = {
    'material_cyan_700': '#129EAF',  # default
    'material_teal_700': '#00897B',  # training dataset
    'material_indigo_400': '#5C6BC0',  # eval dataset
    'material_purple_500': '#A142F4'  # quantitative analysis
}


@attr.s(auto_attribs=True)
class _Graph():
  """Model Card graph."""

  # Necessary data to draw a graph.
  x: Optional[Sequence[Union[str, int, float]]] = None
  xerr: Optional[Sequence[Sequence[Union[int, float]]]] = None
  y: Optional[Sequence[Union[str, int, float]]] = None
  xlabel: Optional[str] = None
  ylabel: Optional[str] = None
  title: Optional[str] = None
  name: Optional[str] = None
  color: str = _COLOR_PALETTE['material_cyan_700']

  # Graph generated from the data above.
  figure: Optional[matplotlib.figure.Figure] = None
  base64str: Optional[str] = None


def annotate_dataset_feature_statistics_plots(

# Path: model_card_toolkit/model_card.py
# class Owner(BaseModelCardField):
# class Version(BaseModelCardField):
# class License(BaseModelCardField):
# class Reference(BaseModelCardField):
# class Citation(BaseModelCardField):
# class ModelDetails(BaseModelCardField):
# class Graphic(BaseModelCardField):
# class GraphicsCollection(BaseModelCardField):
# class SensitiveData(BaseModelCardField):
# class Dataset(BaseModelCardField):
# class KeyVal(BaseModelCardField):
# class ModelParameters(BaseModelCardField):
# class ConfidenceInterval(BaseModelCardField):
# class PerformanceMetric(BaseModelCardField):
# class QuantitativeAnalysis(BaseModelCardField):
# class User(BaseModelCardField):
# class UseCase(BaseModelCardField):
# class Limitation(BaseModelCardField):
# class Tradeoff(BaseModelCardField):
# class Risk(BaseModelCardField):
# class Considerations(BaseModelCardField):
# class ModelCard(BaseModelCardField):
#   def to_json(self) -> str:
#   def from_json(self, json_dict: Dict[str, Any]) -> None:
#   def merge_from_json(self, json: Union[Dict[str, Any], str]) -> None:


# Path: model_card_toolkit/utils/graphics.py
import base64
import io
import logging
import attr
import matplotlib
import matplotlib.pyplot as plt
import tensorflow_model_analysis as tfma
from typing import Sequence, Tuple, Union, Optional
from model_card_toolkit import model_card as model_card_module
from tensorflow_metadata.proto.v0 import statistics_pb2



_COLOR_PALETTE = {
    'material_cyan_700': '#129EAF',  # default
    'material_teal_700': '#00897B',  # training dataset
    'material_indigo_400': '#5C6BC0',  # eval dataset
    'material_purple_500': '#A142F4'  # quantitative analysis
}


@attr.s(auto_attribs=True)
class _Graph():
  """Model Card graph."""

  # Necessary data to draw a graph.
  x: Optional[Sequence[Union[str, int, float]]] = None
  xerr: Optional[Sequence[Sequence[Union[int, float]]]] = None
  y: Optional[Sequence[Union[str, int, float]]] = None
  xlabel: Optional[str] = None
  ylabel: Optional[str] = None
  title: Optional[str] = None
  name: Optional[str] = None
  color: str = _COLOR_PALETTE['material_cyan_700']

  # Graph generated from the data above.
  figure: Optional[matplotlib.figure.Figure] = None
  base64str: Optional[str] = None


def annotate_dataset_feature_statistics_plots(

    model_card: model_card_module.ModelCard,