Webhooks are a foundation for MLOps-related features. They allow you to listen for new changes on specific repos or to
Webhooks server
Webhooks are a foundation for MLOps-related features. They allow you to listen for new changes on specific repos or to all repos belonging to particular users/organizations you're interested in following. To learn more about webhooks on the Huggingface Hub, you can read the Webhooks guide.
Tip Check out this guide for a step-by-step tutorial on how to set up your webhooks server and deploy it as a Space.
Warning This is an experimental feature. This means that we are still working on improving the API. Breaking changes might be introduced in the future without prior notice. Make sure to pin the version of
huggingface_hubin your requirements. A warning is triggered when you use an experimental feature. You can disable it by settingHF_HUB_DISABLE_EXPERIMENTAL_WARNING=1as an environment variable.
Server
The server is a Gradio app. It has a UI to display instructions for you or your users and an API to listen to webhooks. Implementing a webhook endpoint is as simple as decorating a function. You can then debug it by redirecting the Webhooks to your machine (using a Gradio tunnel) before deploying it to a Space.
WebhooksServer
[[autodoc]] huggingface_hub.WebhooksServer
@webhook_endpoint
[[autodoc]] huggingface_hub.webhook_endpoint
Payload
WebhookPayload is the main data structure that contains the payload from Webhooks. This is
a pydantic class which makes it very easy to use with FastAPI. If you pass it as a parameter to a webhook endpoint, it
will be automatically validated and parsed as a Python object.
For more information about webhooks payload, you can refer to the Webhooks Payload guide.
[[autodoc]] huggingface_hub.WebhookPayload
WebhookPayload
[[autodoc]] huggingface_hub.WebhookPayload
WebhookPayloadComment
[[autodoc]] huggingface_hub.WebhookPayloadComment
WebhookPayloadDiscussion
[[autodoc]] huggingface_hub.WebhookPayloadDiscussion
WebhookPayloadDiscussionChanges
[[autodoc]] huggingface_hub.WebhookPayloadDiscussionChanges
WebhookPayloadEvent
[[autodoc]] huggingface_hub.WebhookPayloadEvent
WebhookPayloadMovedTo
[[autodoc]] huggingface_hub.WebhookPayloadMovedTo
WebhookPayloadRepo
[[autodoc]] huggingface_hub.WebhookPayloadRepo
WebhookPayloadUrl
[[autodoc]] huggingface_hub.WebhookPayloadUrl
WebhookPayloadWebhook
[[autodoc]] huggingface_hub.WebhookPayloadWebhook
Source and license
Source: Hub Python Library documentation, adapted for this site. Licensing and attribution follow the terms of the upstream project.