List all tasks from hfapi

Is it possible to list all tasks from hfapi like object detection etc.

And then search for the top 50 downloaded models for each task? thanks :slight_smile:

Hi @Rodas96, I don’t think there is a built-in way to to list all tasks using HfApi. However, you can call which is the JSON equivalent of this page (Tasks - Hugging Face) on which we maintain a list of tasks with documentation, examples and suggested models for each task.

Once you’ve retrieved this list of tasks, you can search for the top downloaded models using list_models. The output is a generator looping through the models returned by the server.

from huggingface_hub import list_models

for model in list_models(limit=10, sort="downloads", direction=-1, filter="object-detection"):
    print(, model.downloads)
microsoft/table-transformer-detection 1132061
microsoft/table-transformer-structure-recognition 842637
facebook/detr-resnet-50 463835
hustvl/yolos-tiny 260857
facebook/detr-resnet-101 135484
TahaDouaji/detr-doc-table-detection 86751
hustvl/yolos-small 71631
microsoft/table-transformer-structure-recognition-v1.1-all 59846
fcakyon/yolov5s-v7.0 34056
keremberke/yolov5n-license-plate 28780
1 Like

tyvm @Wauplin :slight_smile:

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.