For invoking the annotator from CPS, make sure of the following:
- The API is running (see above) and is reachable from the CPS instance.
- For development, you could use ngrok, see section below.
- Create a Model in CPS and give it a name. (In the screenshot below it's "external-ngrok".)
- Choose Type
ExternalApiAnnotator
. - Add a header with key
Authorization
and set its Value to theApi Key
from yourconfig.json
. - As URL, provide the endpoint of your API, for example:
- http://localhost:5000/api/v1/annotators/SimpleTextGeographyAnnotator if you have a local CPS instance,
- else the same with your ngrok address instead of
localhost:5000
.
CPS will validate the configuration discovery of your annotator and confirm that the model is correct. If yes, the UI will show the list of entities and relationships declared by your annotator.
You can then try the new model in the "Preview" field, and use it in a CPS dataflow.
You can use the annotator on text and tables.
After running and testing the application locally, you can create a tunnel with ngrok to expose it to test in CPS by creating an external API model.
- Access https://ngrok.com and go into signup (if you don't have an account yet).
- Fill with your information (email, name, password)
- Download the .zip from the get started page of the dashboard at https://dashboard.ngrok.com/get-started/setup
- Extract the ngrok tool.
- In the repository where you put ngrok, run
./ngrok authtoken {token}
with the token provided in the get started screen: