Skip to content

This is a Flask + Docker deployment of the PyTorch-based Named Entity Recognition (NER) Model (BiLSTM-CRF) in the Medical AI.

License

Notifications You must be signed in to change notification settings

SuperBruceJia/pytorch-flask-deploy-webapp

Repository files navigation

MedicalNER: Deploy PyTorch NER Model with Flask and Docker as Web App

A pretty and customizable web app to deploy your Deep Learning (DL) model with ease

Notice

This repo was to deploy any kind of ML or DL model(s) rather than just NER model.

Usage Demo

  1. Clone the repo

    $ git clone https://github.com/SuperBruceJia/pytorch-flask-deploy-webapp.git
    
  2. Run the following instructions

    1). Build Docker Image

    $ docker build -t ner-model .
    

    2). Make and Run a container for the above Image

    $ docker run -e LANG=C.UTF-8 -e LC_ALL=C.UTF-8 -it --rm -d -p 8000:8000 ner-model
    
    or 
    
    $ docker run -d -p 8000:8000 ner-model
    
  3. Open the following URL (Google Chrome is recommended)

    http://0.0.0.0:8000/apidocs/#!/default/get_predict
    
    or 
    
    http://0.0.0.0:8000/apidocs
  4. Input a medical sentence (in Chinese) and see the recognized entities!

    🏆 Enjoy your journey!

Docker Image

The Docker Images have been uploaded to Docker Hub.

Size of the Docker Image

  1. Anaconda Python Environment --> 2.22 GB (V1.0)

    Used Image: continuumio/anaconda3:4.4.0

  2. Standard Python Environment --> 617.96 MB (V2.0)

    Used Image: Python:3

  3. Smaller Python Environment --> 447.05 MB (V4.0)

    Used Image: python:3.8-slim-buster with Apache 2

  4. Much Smaller Python Environment --> 169.02 MB (V5.0)

    Used Image: python:3.8-slim-buster without Apache 2

Reference Image and Readings

  1. Python Image

  2. Anaconda Image

  3. My uploaded Docker Images

  4. The best Docker base image for your Python application

  5. Docker Container UTF-8 Encoding

License

MIT License