# List all tasks from hfapi

**URL:** <https://discuss.huggingface.co/t/list-all-tasks-from-hfapi/68661>\
**Category:** Models\
**Created:** [January 10, 2024, 12:30pm UTC](https://discuss.huggingface.co/t/list-all-tasks-from-hfapi/68661 "2024-01-10T12:30:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rodas96](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/rodas96/32/22863_2.png) [@Rodas96](https://discuss.huggingface.co/u/Rodas96)\
**Post date:** [January 10, 2024, 12:30pm UTC](https://discuss.huggingface.co/t/list-all-tasks-from-hfapi/68661/1 "2024-01-10T12:30:35Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Wauplin](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/wauplin/32/40815_2.png) [@Wauplin](https://discuss.huggingface.co/u/Wauplin)\
**Post date:** [January 12, 2024, 10:01am UTC](https://discuss.huggingface.co/t/list-all-tasks-from-hfapi/68661/2 "2024-01-12T10:01:22Z")

</div>

Hi @Rodas96, I don’t think there is a built-in way to to list all tasks using `HfApi`. However, you can call [https://huggingface.co/api/tasks](https://huggingface.co/api/tasks) which is the JSON equivalent of this page ([Tasks - Hugging Face](https://huggingface.co/tasks)) 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](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.list_models). The output is a generator looping through the models returned by the server.

```py
from huggingface_hub import list_models

for model in list_models(limit=10, sort="downloads", direction=-1, filter="object-detection"):
    print(model.id, model.downloads)

```

```auto
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

```

---

<div class="post-metadata">

**Author:** ![Rodas96](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/rodas96/32/22863_2.png) [@Rodas96](https://discuss.huggingface.co/u/Rodas96)\
**Post date:** [January 15, 2024, 1:10pm UTC](https://discuss.huggingface.co/t/list-all-tasks-from-hfapi/68661/3 "2024-01-15T13:10:59Z")

</div>

tyvm @Wauplin 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](https://discuss.huggingface.co/u/system)\
**Post date:** [January 16, 2024, 1:11am UTC](https://discuss.huggingface.co/t/list-all-tasks-from-hfapi/68661/4 "2024-01-16T01:11:30Z")

</div>

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