inception-project / inception-external-recommender

Get annotation suggestions for the INCEpTION text annotation platform from spaCy, Sentence BERT, scikit-learn and more. Runs as a web-service compatible with the external recommender API of INCEpTION.
Apache License 2.0
40 stars 17 forks source link

[Question] How to use inception-external-recommender without running inception #16

Closed sdes-upf closed 3 years ago

sdes-upf commented 3 years ago

I was wondering if there is a way to run inception-external-recommender without a GUI, just sending programmatically a request to the running server.

For example, if i wanted to run the example code to start the server from the readme,

from ariadne.contrib.spacy import SpacyNerClassifier, SpacyPosClassifier
from ariadne.server import Server

server = Server()
server.add_classifier("spacy_ner", SpacyNerClassifier("en"))
server.add_classifier("spacy_pos", SpacyPosClassifier("en"))

server.start()

Then how could I send a text/Cas to http://localhost:5000/spacy_ner/predict to get the appropriate predictions returned as a JSON, for example?

jcklie commented 3 years ago

There are example requests in https://github.com/inception-project/inception-external-recommender/tree/master/examples/requests and the protocol is described in https://inception-project.github.io/releases/0.17.4/docs/developer-guide.html#_external_recommender . It might be easier to adapt the code to use your protocol and just use our core that manages models if you do not want to use XMI/UIMA.