You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .env.example
+16-1Lines changed: 16 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,4 +13,19 @@ ENABLE_CACHE=false
13
13
CACHE_DURATION_SECONDS=60
14
14
15
15
# (Optional. Default: auto. Options: auto,cpu,cuda) Set torch default device for detoxify library. Automatically detect if cuda/gpu device is available
16
-
TORCH_DEVICE=auto
16
+
TORCH_DEVICE=auto
17
+
18
+
# (Required. Default: detoxify. Options: detoxify, hybrid, custom). Set classification model to be used in prediction. "hybrid" and "custom" can be used as fast model if application run on machine without GPU.
19
+
HATE_SPEECH_MODEL=detoxify
20
+
21
+
# (Optional. Default: "". Options: "any potential words") Some potential toxic words can be included to assist hybrid model detection. Hybrid approach uses both custom and detoxify model based on probability thresold.
22
+
# POTENTIAL_TOXIC_WORDS="f**k,n***a,ni**er"
23
+
24
+
# (Optional. Default: 0.5 . Options: float value between 0.0 and 1.0) Probability thresold when using "hybrid" model. The thresold will determine whether to continue classify using detoxify model after using custom model
25
+
HYBRID_THRESOLD_CHECK=0.5
26
+
27
+
# (Optional. Default: "./experiments/model_voting_partial_best.pkl") Custom model path. Custom Pretrained model (pickle) of scikit-learn which implement predict_proba
# (Optional. Default: "./experiments/vectorizer_count_no_stop_words.pkl") Custom vectorizer path. Custom Vectorizer model (pickle) of scikit-learn which implement vector transform for text
Copy file name to clipboardExpand all lines: README.md
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,12 @@
1
1
# hate-speech-detector-api
2
2
3
-
A Simple PoC (Proof of Concept) of Hate-speech (Toxic content) Detector API Server using model from [detoxify](https://github.com/unitaryai/detoxify). Detoxify (unbiased model) achieves score of 93.74% compared to top leaderboard score with 94.73% in [Jigsaw Unintended Bias in Toxicity Classification](https://www.kaggle.com/c/jigsaw-unintended-bias-in-toxicity-classification).
3
+
A Simple PoC (Proof of Concept) of Hate-speech (Toxic content) Detector API Server using model from [detoxify](https://github.com/unitaryai/detoxify) and/or [custom traditional machine learning](experiments/model_voting_partial_best.pkl) model. Detoxify (unbiased model) achieves AUC score of 93.74% compared to top leaderboard score with AUC 94.73% in [Jigsaw Unintended Bias in Toxicity Classification](https://www.kaggle.com/c/jigsaw-unintended-bias-in-toxicity-classification). To those who are interested in training custom machine learning model based on [Jigsaw Unintended Bias in Toxicity Classification](https://www.kaggle.com/c/jigsaw-unintended-bias-in-toxicity-classification) can take a look at our [Jupyter Notebook](experiments/hate-speech-classification.ipynb).
4
+
5
+
hate-speech-detector-api is a core dependency of [nostr-filter-relay](https://github.com/atrifat/nostr-filter-relay).
4
6
5
7
## Demo
6
8
7
-
A demo instance is available on [HuggingFace Spaces - https://atrifat-hate-speech-detector-api-demo.hf.space](https://atrifat-hate-speech-detector-api-demo.hf.space). There is no guarantee for the uptime, but feel free to test.
9
+
A demo gradio showcase is available on [HuggingFace Spaces - https://huggingface.co/spaces/rifatramadhani/hate-speech-detector](https://huggingface.co/spaces/rifatramadhani/hate-speech-detector). There is no guarantee for the uptime, but feel free to test.
0 commit comments