Package: trunklucator
Trunklucator is a python module for data scientists and ML practitioners for quick creating annotation projects and testing your ideas. It acts like a python's native input() function, but support displaying rich content and advance interaction with the user (using a web browser). Trunklucator lets you easily plug interaction with a human to your model prototype.ExamplefromtrunklucatorimportWebUIwithWebUI()aswebui:# start http server in backgroundforitemindata:y=webui.ask(item)#<- wait for user action on web pageprint(y)For full examples seeexamples/quickstartdirectoryTaskScreenshotExample codebinary classificationFor images -examples/quickstart/binary_class_image.pyFor text -examples/quickstart/binary_class_text.pymulticlass classificationexamples/quickstart/multi_class_text.pymultilabel classificationexamples/quickstart/multi_label_text.pyNamed Entity Recognition (NER)examples/quickstart/ner_text.pyHTML page annotationexamples/quickstart/ner_html.pyTrunklucator is the best when you need to represent complex data like image, formatted text, video or sound to the user and ask the user to label/annotate this data. After a user's action, you immediately are able to use this data in your pipeline.  Trunklucator works well together with active learning (see examplehttps://github.com/Dumbris/pytorch_active_learning/active_learning_basics.py).Installationpip install trunklucatorSettingsYou can use environmet variable to change default parametersHOST - bind to host (default 127.0.0.1)PORT - use port number (default 8086)DATA_DIR - directory will be available through HTTP by path /dataFRONTEND_DIR - directory path to your custom frontendPORT=8080python3main.pyAlso, you can use similar parameters in code then instanciate trunklucator.WebUI class.withWebUI(host='0.0.0.0',port=8080,data_dir='./data',frontend_dir='./myfront')API methodsFor instance of WebUI class:.ask(data, meta(optional))- by calling this method you will stop the execution of your code until the user action in a web browser..update(data)- asynchronously publish information to the frontend part.Running examplesclone github repocd to examples/run python3 filename.py, open browser onhttp://localhost:8086How to display complex dataTrunklucator contains two parts: python module which runs a small HTTP server in the background thread and frontend - it could be any javascript single page application that supports simple protocol for fetching task data.
These parts interact with each other using HTTP  or WebSocket. You don't need to change the python part it's ready to use abstraction.
You can select which frontend part to use by settingfrontend_dirWebUI init parameter or using environment variable FRONTEND_DIR
You can set path to your custom frontend directory or use predefined names for frontends integrated into python package.In the current version there are two frontend integrated:DefaultWebUI(frontend_dir='html_field')designed like hackable part, you can adjust it for your specific data format. The default implementation is able to load arbitrary HTML text. UI controls can be configured in python code.WebUI(frontend_dir='label_studio')- advanced frontend with a support a lot of data types. For more information check the official sitehttps://labelstud.io/and example/quickstart/ner_text.pyTo customize default frontend part:clone github repoMake a copy of trunklucator/frontend/html_field directory. Implementation is simple and doesn't use tools like npm, webpack, etc.You can edit it on disk and after refreshing web page, you will see the results. Use FRONTEND_DIR environment variable to setup path to your custom frontend.