Named Entity Recognition Demo
Introduction
This a simple application showcasing Named Entity Recognition using Transformers as back-end and Flask front-end.
Instructions
Running the application with Docker
This is the easiest way to run the app:
- Clone the repository
- Navigate to the root directory of the repository and run
docker compose up
(when first building image, it may take a while - model needs to be downloaded) - Open your browser and navigate to
http://localhost:5000/
Running the application without Docker
If you don't want to use Docker, you can run the application manually:
- Clone the repository
- Import conda environment from yml file:
conda env create -f environment.yml --name <env_name>
- Activate the environment:
conda activate <env_name>
- Run the application:
python app.py
. (Docker version usesgunicorn
WSGI to run the app) - Open your browser and navigate to
http://localhost:5000/
Running the tests
To run the tests, run pytest
in the root directory of the repository once you have environment ready.
You can also run pytest --cov=.
to get the coverage report.
Usage
Once you have the application running, you enter/paste your text into the textbox and click 'Find named entities' button. The application will return the text with named entities highlighted in colors according to the legend and confidence scores available when hovering over those.
Future improvements
- Separate the front-end and back-end into separate services
- Add more models (and let user choose the model to use in the app)
- Cache models better (downloading it during build is annoying)
- Experiment with different tokenizers and aggregation strategies