Upload catalog.py with huggingface_hub
Browse files- catalog.py +4 -2
catalog.py
CHANGED
|
@@ -52,7 +52,7 @@ class LocalCatalog(Catalog):
|
|
| 52 |
artifact_identifier in self
|
| 53 |
), f"Artifact with name {artifact_identifier} does not exist"
|
| 54 |
path = self.path(artifact_identifier)
|
| 55 |
-
return Artifact.load(path)
|
| 56 |
|
| 57 |
def __getitem__(self, name) -> Artifact:
|
| 58 |
return self.load(name)
|
|
@@ -105,7 +105,9 @@ class GithubCatalog(LocalCatalog):
|
|
| 105 |
url = self.path(artifact_identifier)
|
| 106 |
response = requests.get(url)
|
| 107 |
data = response.json()
|
| 108 |
-
|
|
|
|
|
|
|
| 109 |
|
| 110 |
def __contains__(self, artifact_identifier: str):
|
| 111 |
url = self.path(artifact_identifier)
|
|
|
|
| 52 |
artifact_identifier in self
|
| 53 |
), f"Artifact with name {artifact_identifier} does not exist"
|
| 54 |
path = self.path(artifact_identifier)
|
| 55 |
+
return Artifact.load(path, artifact_identifier)
|
| 56 |
|
| 57 |
def __getitem__(self, name) -> Artifact:
|
| 58 |
return self.load(name)
|
|
|
|
| 105 |
url = self.path(artifact_identifier)
|
| 106 |
response = requests.get(url)
|
| 107 |
data = response.json()
|
| 108 |
+
new_artifact = Artifact.from_dict(data)
|
| 109 |
+
new_artifact.artifact_identifier = artifact_identifier
|
| 110 |
+
return new_artifact
|
| 111 |
|
| 112 |
def __contains__(self, artifact_identifier: str):
|
| 113 |
url = self.path(artifact_identifier)
|