YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
OpenedAI Moderations
An OpenAI API compatible moderations server for checking whether text is potentially harmful.
This server is built using moderation by embeddings by ifmain (Mike Afton) and FastAPI.
This is not affiliated with OpenAI in any way, and no OpenAI API key is required.
Quickstart
Docker (recommended):
docker compose up
or:
apt install git git-lfs
git clone https://huggingface.co/ifmain/moderation_by_embeddings repos/moderation_by_embeddings
pip install -r requirements.txt
python moderations.py --host 127.0.0.1 --port 5002
You can use the OpenAI client to interact with the API.
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:5002/v1", api_key='skip')
moderation = client.moderations.create(input="I want to kill them.")
print(moderation.results[0])
Links & Documentation
- Swagger API docs are available locally via /docs, here: (http://localhost:5002/docs) if you are using the defaults.
- OpenAI Moderations Guide: (https://platform.openai.com/docs/guides/moderation)
- OpenAI Moderations API Reference: (https://platform.openai.com/docs/api-reference/moderations)
- Moderation Model: moderation by embeddings by ifmain (Mike Afton)
- Embedding model: (https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2)