Update README.md
Browse files
README.md
CHANGED
@@ -15,12 +15,12 @@ Current datasets include:
|
|
15 |
You can read in a label file as follows (using the `huggingface_hub` library):
|
16 |
|
17 |
```
|
18 |
-
from huggingface_hub import
|
19 |
import json
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
id2label = json.load(open(
|
24 |
id2label = {int(k):v for k,v in id2label.items()}
|
25 |
```
|
26 |
|
|
|
15 |
You can read in a label file as follows (using the `huggingface_hub` library):
|
16 |
|
17 |
```
|
18 |
+
from huggingface_hub import hf_hub_download
|
19 |
import json
|
20 |
|
21 |
+
repo_id = "datasets/huggingface/label-files"
|
22 |
+
filename = "imagenet-22k-id2label.json"
|
23 |
+
id2label = json.load(open(hf_hub_download(repo_id, filename, repo_type="dataset"), "r"))
|
24 |
id2label = {int(k):v for k,v in id2label.items()}
|
25 |
```
|
26 |
|