Skip to content

RedStoneCraftGG/df-detoxify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

df-detoxify

A simple and effective tool utilizing AI to detect bad words and toxic language.

Abstract

As an admin on Venity Network, I’ve had a problem dealing with toxic players. Sometimes they keep arguing and causing drama even after being muted, and it can go on endlessly (many of them even evade mutes using alternate accounts).

Eventually, I got an idea from the players who constantly yapping about how many toxic words appear in chat, and the solution I found was the good old simple AI-based toxicity detector called Detoxify. Detoxify was created by Unitary and comes with 3 detection models. It can also detect many different types of toxic language, which makes it highly accurate. Kinda...

Its multilingual support also helps detect offensive or toxic words in many languages other than English, and the best thing, it can understand context too. So this project example should make it easier to implement something like this into a server.

How to Run

There are two main components: a Python API (for toxicity detection using Detoxify) and the Go server integration.

1. Run the Detoxify API

Requirements:

  • Python 3.10+
  • pip (package manager)
  • detoxify library
  • Important: Make sure your numpy version is less than 2 (e.g., 1.26.x).

Install dependencies:

pip install -r API/requirements.txt

Start the API server:

cd API
uvicorn run:app --host 0.0.0.0 --port 8000 --workers 1

The API will now be running on http://localhost:8000.

2. Run the Go (Dragonfly) Server

Requirements:

  • Go 1.24+
  • Project dependencies (see go.mod for details)

Build and run the server:

go build -o df-detoxify
./df-detoxify

Or simply run go run .

The Go server will interact with the Detoxify API to moderate chat messages for toxicity.

Note: You can configure toxicity thresholds in config.toml.

3. Autorun (Recommended for local demo)

Windows PowerShell:

./scripts/autorun.ps1

If dependencies are already installed:

./scripts/autorun.ps1 -SkipInstall

What this script does:

  • Optionally installs Python dependencies from API/requirements.txt
  • Starts Detoxify API at 127.0.0.1:8000
  • Starts Dragonfly server using go run .
  • Stops API automatically when Go server exits

4. Configuration

  • Adjust toxicity category thresholds in config.toml to tune moderation sensitivity.
  • Ensure the API is running before starting the Go server.
  • To test if the API is working, try running test.py and see if the toxic detector is working properly.

About

A simple and effective tool utilizing AI to detect bad words and toxic language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors