Upload api.py with huggingface_hub
Browse files
api.py
CHANGED
|
@@ -6,15 +6,15 @@ from .artifact import fetch_artifact
|
|
| 6 |
from .dataset_utils import get_dataset_artifact
|
| 7 |
from .logging_utils import get_logger
|
| 8 |
from .metric_utils import _compute
|
| 9 |
-
from .operator import
|
| 10 |
|
| 11 |
logger = get_logger()
|
| 12 |
|
| 13 |
|
| 14 |
-
def load(source: Union[
|
| 15 |
assert isinstance(
|
| 16 |
-
source, (
|
| 17 |
-
), "source must be a
|
| 18 |
if isinstance(source, str):
|
| 19 |
source, _ = fetch_artifact(source)
|
| 20 |
return source().to_dataset()
|
|
|
|
| 6 |
from .dataset_utils import get_dataset_artifact
|
| 7 |
from .logging_utils import get_logger
|
| 8 |
from .metric_utils import _compute
|
| 9 |
+
from .operator import SourceOperator
|
| 10 |
|
| 11 |
logger = get_logger()
|
| 12 |
|
| 13 |
|
| 14 |
+
def load(source: Union[SourceOperator, str]) -> DatasetDict:
|
| 15 |
assert isinstance(
|
| 16 |
+
source, (SourceOperator, str)
|
| 17 |
+
), "source must be a SourceOperator or a string"
|
| 18 |
if isinstance(source, str):
|
| 19 |
source, _ = fetch_artifact(source)
|
| 20 |
return source().to_dataset()
|