Skip to content
ruitedk6 edited this page Jul 13, 2020 · 1 revision

API

You can call your own functions from the annotation tool by sending a POST request to /api/callAPI. The request hast to contain a json with the attribute api_call which corresponds to the desired function's name. All other attributes will be the parameters when the function is called.

This is used already in:

  • labelPicture
  • labelWords

If you want to write your own state look at the above for inspiration.

Example

  1. Write a function in api.py:
def foo(arg1):
    ...
  1. Send a request to /api/callAPI with this json:
{
"api_call": "foo",
"arg1": "bar"
}
  1. This will call in api.py:
foo(arg1=bar)
Clone this wiki locally