Sign inSign up

remdex/lhc-detoxify

By remdex

•Updated over 1 year ago

Insult detection Rest API service based on Detoxify⁠ package.

Image
Machine learning & AI
0

827

remdex/lhc-detoxify repository overview

⁠Detoxify Rest API docker image

HTTP API to classify the toxicity of text messages. This was inspired by detoxify-flask-container⁠ with a few changes

Source of this docker image can be found https://github.com/LiveHelperChat/detoxify-flask-container⁠

  • Proper JSON response
  • Three models loaded directly multilingual original-small original
  • Build fixes I encountered
  • Memory leaks I found were fixed

⁠Usage

⁠1. Start the service

The following command starts the service on port 8080.

Pulls image always

docker run --pull always --rm --name lhc-detoxify \
    -p 8080:80 -e DETOXIFY_MODEL="original-small" \
    remdex/lhc-detoxify:latest

Runs local image if it exists. Useful if you are building custom image

docker run --rm --name lhc-detoxify \
  -p 8080:80 -e DETOXIFY_MODEL="original-small" \
  remdex/lhc-detoxify:latest

Restart on failure

docker run -d --pull always --name lhc-detoxify -p 8080:80 -e DETOXIFY_MODEL="original-small" --restart always remdex/lhc-detoxify:latest
⁠Build from scratch
docker build  --progress=plain -f Containerfile -t remdex/lhc-detoxify .
⁠2. Request toxicity information

The following command sends a HTTP request that classifies the toxicity of a text message.

curl '127.0.0.1:8080?text=foobar'

⁠Known issues

There is still a memomry leak whcih I could not trace back and I think it's related to Detoxify package itself. It's recomended to restart docker image daily etc.

12 12 * * * /usr/bin/docker restart lhc-detoxify /dev/null 2>&1

⁠Attribution

Tag summary

Content type

Image

Digest

sha256:cc312c1cf…

Size

2 GB

Last updated

over 1 year ago

docker pull remdex/lhc-detoxify