Spaces:
Runtime error
Runtime error
fix readme 404
Browse files
app.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
#!/usr/bin/env python3
|
|
|
|
|
2 |
from huggingface_hub import HfApi, hf_hub_download
|
3 |
from huggingface_hub.repocard import metadata_load
|
4 |
|
@@ -19,8 +21,12 @@ def get_model_ids():
|
|
19 |
def get_metadatas(model_ids):
|
20 |
metadatas = {}
|
21 |
for model_id in model_ids:
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
24 |
return metadatas
|
25 |
|
26 |
|
|
|
1 |
#!/usr/bin/env python3
|
2 |
+
import requests
|
3 |
+
|
4 |
from huggingface_hub import HfApi, hf_hub_download
|
5 |
from huggingface_hub.repocard import metadata_load
|
6 |
|
|
|
21 |
def get_metadatas(model_ids):
|
22 |
metadatas = {}
|
23 |
for model_id in model_ids:
|
24 |
+
try:
|
25 |
+
readme_path = hf_hub_download(model_id, filename="README.md")
|
26 |
+
metadatas[model_id] = metadata_load(readme_path)
|
27 |
+
except requests.exceptions.HTTPError:
|
28 |
+
# 404 README.md not found
|
29 |
+
metadatas[model_id] = None
|
30 |
return metadatas
|
31 |
|
32 |
|