Upload api.py with huggingface_hub
Browse files5 unmodified lines678910111213141516171819205 unmodified linesfrom .dataset_utils import get_dataset_artifactfrom .logging_utils import get_loggerfrom .metric_utils import _computefrom .operator import StreamSourcelogger = get_logger()def load(source: Union[StreamSource, str]) -> DatasetDict:assert isinstance(source, (StreamSource, str)), "source must be a StreamSource or a string"if isinstance(source, str):source, _ = fetch_artifact(source)return source().to_dataset()5 unmodified lines678910111213141516171819205 unmodified linesfrom .dataset_utils import get_dataset_artifactfrom .logging_utils import get_loggerfrom .metric_utils import _computefrom .operator import SourceOperatorlogger = get_logger()def load(source: Union[SourceOperator, str]) -> DatasetDict:assert isinstance(source, (SourceOperator, str)), "source must be a SourceOperator or a string"if isinstance(source, str):source, _ = fetch_artifact(source)return source().to_dataset()
api.py+4-4