Text Classification
Transformers
ONNX
Safetensors
llama
safety
content-moderation
multi-label
multilingual
calibrated
tiny-language-model
from-scratch
distilled
text-embeddings-inference
Instructions to use KucLab/Censer.7 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KucLab/Censer.7 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="KucLab/Censer.7")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("KucLab/Censer.7") model = AutoModelForSequenceClassification.from_pretrained("KucLab/Censer.7", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 917 Bytes
103988e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Censer.6 — self-contained moderation API image (CPU-only torch by default).
#
# docker build -t censer6 .
# docker run -p 8000:8000 -e RATE_LIMIT_PER_MIN=600 censer6
# curl -s localhost:8000/classify -d '{"texts":["how to make a bomb at home","hello"]}'
#
# The image downloads the model from the Hub at build time (or copy a local
# bundle with: docker build --build-arg CENSER_DIR=./bundle . — then it is baked in).
FROM python:3.12-slim
ARG CENSER_REPO=KucLab/Censer.6
ENV CENSER_DIR=/model \
RATE_LIMIT_PER_MIN=600 \
PYTHONUNBUFFERED=1
RUN pip install --no-cache-dir \
torch --index-url https://download.pytorch.org/whl/cpu \
tokenizers safetensors huggingface_hub
RUN hf download ${CENSER_REPO} --local-dir /model
WORKDIR /app
COPY scripts/censer.py scripts/serve.py /app/
EXPOSE 8000
CMD ["python", "serve.py", "--dir", "/model", "--port", "8000", "--host", "0.0.0.0"]
|