GitLab upgrade completed. Current version is 17.11.3.
This merge request combines a number of suggestions for improvements to the Flask-based REST service to make it more efficient and more suitable for integration into the ELG.
Currently the REST service spawns a new sub-process for the transformer command line tool for every incoming request. This is inefficient since the sub-process must load the NER model afresh every time, and the way temporary files are used to pass the text back and forth mean that there is a race condition whereby if the service is run with more than one gunicorn worker and both workers are handling requests at the same time, both callers may see the same set of results (from one or other of the calls) rather than each seeing their own.
This merge changes things so that rather than spawning sub-processes, the Flask app loads the models up front once at startup time, into the same Python process, then uses the loaded model to handle all requests.
For the ELG endpoint, I've made various changes to make better use of the ELG API specification:
"role":"sentence"
to indicate they are separate sentences rather than alternatives for a single segment.replace_type
and replace_prob
parameter values, returning valid ELG error messages if the values are wrong.