{"id":14482781,"url":"https://github.com/strayMat/tag_serve","last_synced_at":"2025-08-30T03:32:18.259Z","repository":{"id":75587711,"uuid":"141709460","full_name":"strayMat/tag_serve","owner":"strayMat","description":"Deployable Neural Tagger implementation for Named Entity Recognition","archived":false,"fork":false,"pushed_at":"2018-12-09T19:29:43.000Z","size":23682,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T00:34:25.561Z","etag":null,"topics":["bilstm-crf","deep-learning","docker-image","flask","flask-application","machine-learning","ner","neural-network","nlp","pytorch","tagger"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strayMat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-07-20T12:28:53.000Z","updated_at":"2025-01-13T05:49:24.000Z","dependencies_parsed_at":"2023-06-07T00:15:13.380Z","dependency_job_id":null,"html_url":"https://github.com/strayMat/tag_serve","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/strayMat/tag_serve","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strayMat%2Ftag_serve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strayMat%2Ftag_serve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strayMat%2Ftag_serve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strayMat%2Ftag_serve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strayMat","download_url":"https://codeload.github.com/strayMat/tag_serve/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strayMat%2Ftag_serve/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272800741,"owners_count":24995138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bilstm-crf","deep-learning","docker-image","flask","flask-application","machine-learning","ner","neural-network","nlp","pytorch","tagger"],"created_at":"2024-09-03T00:01:17.415Z","updated_at":"2025-08-30T03:32:15.697Z","avatar_url":"https://github.com/strayMat.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"\n# WEB-API for Pytorch NER model\n\nThis project seeks to facilitate the exchange and diffusion of NER models built with different architectures. We strongly used the code from [NCRF++](https://github.com/jiesutd/NCRFpp) which allow to build various NER neural models in pytorch.\n\nThe `tag_serve` repo adapts the ner model from [NCRF++](https://github.com/jiesutd/NCRFpp) and wrap it in a flask API to allow live demo via a web page and a deployment for medium scale production. \n\n## Installing from source\n\nYou can install `tag_serve` from source by cloning the git repository:\n\n`git clone https://github.com/strayMat/tag_serve.git`\n\nCreate a Python 3.6 virtual environment, and install the necessary requirements by running:\n\n`./src/install_requirements.sh`\n\n## Call the API\n\n### Launch API and web demo locally\n\n+ Launch the API: `python app.py`\n+ Open in the client in browser: `firefox client/pred_client.html`\n\n### Launch API and send multiple files\n\n+ Launch the API: `python app.py`\n+ Launch call function: `python client/call.py -i decoding/ins/ -o decoding/outs/`\n(add `-v` to get visualization `.html`: `python client/call.py -i decoding/ins/ -o decoding/outs/ -v`)\n\n### With a curl command\n\nIn your terminal, run :\n\n`curl -H 'Content-type:application/json' -d '{\"file\":\"Paris is wonderful!\"}' localhost:5000/predict`\n\n\n## Change the trained model used by the API\nYou can either give a specific model to the api, when launching the python code `app.py` or replace the default model in the `pretrained` directory.\n\n+ **Specify a model to `app.py`**: Launch the api with the `-m` option and specify your `new_model` name, `python app.py -m myModel/new_model` where the folder `myModel` should contain `new_model.xpt` and `new_model.model` (the architecture and the weights of the model). \n \n+ **Replace the baseline model**: Replace directly the baseline files in the pretrained directory: put new `baseline.xpt` and `baseline.model` in the `pretrained/` folder (you can check that the default model of the app is    `pretrained/baseline` by typing `python app.py --help`)\n\n\n## Use docker\nYou can deploy the model with docker. Go on docker website to install docker and docker-compose. Then build the docker with:\n\n`sudo docker build --build-arg http_proxy=$yourProxy -t yourTag .`\n\nRun the docker with :\n\n`sudo docker run -d -p 5000:5000 --name tagger yourTag python3 /app/app.py`\n\nYou can now access the docker API with the call methods of your choice (`client/call.py`, `client/predict_client.html` or `curl`)\n\n## Train your own model\nGo see the demonstration notebook: [train_decode_template.ipynb](https://github.com/strayMat/tag_serve/blob/master/nermodel/train_decode_template.ipynb)\n\n## References:\n\n+ [NCRF++  : An Open-source Neural Sequence Labeling Toolkit, Yang et Zhang, 2018](https://arxiv.org/abs/1806.05626)\n\n+ Many thanks to [Guillaume Genthial](https://guillaumegenthial.github.io/serving.html) for the excellent blog post on python web-api with flask.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FstrayMat%2Ftag_serve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FstrayMat%2Ftag_serve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FstrayMat%2Ftag_serve/lists"}