Add Blog Subtitle's.
In this tutorial, we will show how to use webhooks to monitor actions in Kili, such as a label creation. The goal of this tutorial is to illustrate some basic components and concepts of Kili in a simple way, but also to dive into the actual process of iteratively developing real applications in Kili.
Additionally:
For an overview of Kili, visit kili-technology.com You can also check out the Kili documentation https://cloud.kili-technology.com/docs. Our goal is to export labels that can predict whether an image contains a Porsche or a Tesla.
The tutorial is divided into two parts:
Webhooks allow to react to particular action in Kili’s database by triggering a callback whenever an action is completed. For instance, here, every time a label is created in frontend (upper panel), the label can be logged in Python (lower right panel):
from IPython.display import Image
with open('https://raw.githubusercontent.com/kili-technology/kili-playground/e8623b9a6e1de273da6494b5cb1c89f7b8005a9a/recipes/img/websockets.gif','rb') as f:
display(Image(data=f.read(), format='png'))
Kili Playground exposes a method label_created_or_updated
that allows to listen for all actions on labels:
First of all, you need to authenticate:
import os
!pip install kili
from kili.authentication import KiliAuth
from kili.playground import Playground
email = os.getenv('KILI_EMAIL')
password = os.getenv('KILI_PASSWORD')
api_endpoint = 'https://cloud.kili-technology.com/api/label/graphql'
kauth = KiliAuth(email, password, api_endpoint)
playground = Playground(kauth)
Then you can define a callback that will be triggered each time a label gets created/updated:
project_id = 'CHANGE_ME_FOR_YOUR_PROJECT_ID'
def callback(id, data):
print(f'New data: {data}\n')
playground.label_created_or_updated(
project_id=project_id, callback=callback)
In this tutorial, we accomplished the following:
We introduced the concept of webhook and we used label_created_or_updated
to trigger a webhook.
You can also visit the Kili website or Kili documentation for more info!
Lorem Ipsum is a simple dummy text used as a dummy text contents. Lorem ipsum will be replaced. Lorem Ipsum is a simple dummy text used as a dummy text contents. Lorem ipsum will be replaced.Lorem Ipsum is a simple dummy text used as a dummy text contents. Lorem ipsum will be replaced.