Commit
·
1e378d7
1
Parent(s):
d7a9899
add total children downloads
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ from cachetools import cached, TTLCache
|
|
| 8 |
|
| 9 |
@cached(TTLCache(maxsize=10, ttl=60 * 60 * 3))
|
| 10 |
def get_all_models():
|
| 11 |
-
models = list(tqdm(iter(list_models(cardData=True))))
|
| 12 |
return [model for model in models if model is not None]
|
| 13 |
|
| 14 |
|
|
@@ -49,7 +49,7 @@ unique_pipeline_tags = list(
|
|
| 49 |
def parse_org(hub_id):
|
| 50 |
parts = hub_id.split("/")
|
| 51 |
if len(parts) == 2:
|
| 52 |
-
return parts[0] if parts[0] !=
|
| 53 |
else:
|
| 54 |
return "huggingface"
|
| 55 |
|
|
@@ -69,8 +69,13 @@ def return_models_for_base_model(base_model):
|
|
| 69 |
# sort models by downloads
|
| 70 |
models = sorted(models, key=lambda x: x.downloads, reverse=True)
|
| 71 |
results = ""
|
| 72 |
-
results += f"## {base_model} children\n\n"
|
| 73 |
results += f"{base_model} has {len(models)} children\n\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
for model in models:
|
| 75 |
url = f"https://huggingface.co/{model.modelId}"
|
| 76 |
results += (
|
|
|
|
| 8 |
|
| 9 |
@cached(TTLCache(maxsize=10, ttl=60 * 60 * 3))
|
| 10 |
def get_all_models():
|
| 11 |
+
models = list(tqdm(iter(list_models(cardData=True, limit=None))))
|
| 12 |
return [model for model in models if model is not None]
|
| 13 |
|
| 14 |
|
|
|
|
| 49 |
def parse_org(hub_id):
|
| 50 |
parts = hub_id.split("/")
|
| 51 |
if len(parts) == 2:
|
| 52 |
+
return parts[0] if parts[0] != "." else None
|
| 53 |
else:
|
| 54 |
return "huggingface"
|
| 55 |
|
|
|
|
| 69 |
# sort models by downloads
|
| 70 |
models = sorted(models, key=lambda x: x.downloads, reverse=True)
|
| 71 |
results = ""
|
| 72 |
+
results += f"## [`{base_model}`](https://huggingface.co/{base_model}) children\n\n"
|
| 73 |
results += f"{base_model} has {len(models)} children\n\n"
|
| 74 |
+
total_download_number = sum(model.downloads for model in models)
|
| 75 |
+
results += (
|
| 76 |
+
f"`{base_model}`'s children have been"
|
| 77 |
+
f" downloaded {total_download_number:,} times\n\n"
|
| 78 |
+
)
|
| 79 |
for model in models:
|
| 80 |
url = f"https://huggingface.co/{model.modelId}"
|
| 81 |
results += (
|