Skip to content

hoangvu971/NER-project

Repository files navigation

End-to-end Zero-shot Named Entity Recognizer

A comprehensive Named Entity Recognition (NER) system.

Prerequisite for installation and local web deployment

For successful local web deployment, ensure your machine is equipped with both conda and Docker.

Installation summary for deployment

  • conda create -n deploy python=3.9 creates a conda virtual environment
  • conda activate deploy activates the virtual environment
  • requirements/web.in and requirements/dev.in specify core Python packages in that environment
  • make pip-tools-web-deploy resolves all other Python dependencies and installs them
  • export PYTHONPATH="$(pwd):$PYTHONPATH" makes the current directory visible on your Python path -- add it to your ~/.bashrc and source ~/.bashrc

1. Check out the repo

git clone https://github.com/hoangvu971/NER-project
cd NER-project

2. Set up the Python environment

We use conda for managing Pythonversions, and for managing Python package dependencies.

We add a Makefile for making setup dead-simple.

Run conda create -n web-deploy python=3.9 to create an environment called web-deploy.

conda create -n web-deploy python=3.9

Next, activate the conda environment.

conda activate web-deploy

Next: install Python packages

Next, install all necessary Python packages by running

make pip-tools-web-deploy

3. Import model and convert it to ONNX format

The Python script import_and_convert_model.py imports a Hugging Face model and converts it to the ONNX format, enabling easier deployment and integration with various deep learning frameworks.

python training/import_and_convert_model.py

Local web deployment

Navigate to the model_serving folder

cd model_serving

Build and start a Docker container and maps the container's port 3000 to the host's port 3000

docker-compose up --build

Navigate back to the project's root, then go to app_gradio folder

cd app_gradio

Start the Gradio app locally

python app.py

Now you can go to the provided local URL in your terminal on your browser to try out the Gradio app.

Web app example

About

End to end Zero-shot NER

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published