Upload api.py with huggingface_hub
Browse files5 unmodified lines6789910111213141415161716171819205 unmodified linesfrom .dataset_utils import get_dataset_artifactfrom .logging_utils import get_loggerfrom .metric_utils import _computefrom .operator import StreamSourcefrom .operator import SourceOperator
logger = get_logger()
def load(source: Union[StreamSource, str]) -> DatasetDict:def load(source: Union[SourceOperator, str]) -> DatasetDict: assert isinstance( source, (StreamSource, str) ), "source must be a StreamSource or a string" 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