Toxicity-Lens / Dockerfile
prann-ab's picture
Toxicity-Lens v1.0
115e6b1 verified
Raw History Blame Contribute Delete
829 Bytes
# CPU server image: 8-bit ONNX (block-wise; about 0.001 from float32 on average, on any CPU), no PyTorch. Build it from a download of this repository:
# hf download abacusai/Toxicity-Lens --local-dir toxicity-lens --include "*.json" --include server.py \
# --include Dockerfile --include .dockerignore --include onnx/model_int8_block32.onnx
# docker build -t toxicity-lens toxicity-lens && docker run -p 8080:8080 toxicity-lens
FROM python:3.12-slim
RUN pip install --no-cache-dir fastapi==0.138.1 uvicorn==0.49.0 onnxruntime==1.31.1 tokenizers==0.22.2 "numpy<3"
WORKDIR /app
COPY server.py config.json tokenizer.json tokenizer_config.json ./
COPY onnx/model_int8_block32.onnx onnx/
ENV MODEL_DIR=/app BACKEND=onnx MODEL_NAME=toxicity-lens
EXPOSE 8080
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8080"]