Mario Faundez commited on
Commit
a062740
·
1 Parent(s): a3ae041

feat(docs): create documentation

Browse files
Files changed (1) hide show
  1. README.md +52 -0
README.md CHANGED
@@ -11,3 +11,55 @@ license: openrail
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
14
+
15
+
16
+ # Hate Speech Classifier
17
+
18
+ This project uses TensorFlow, and BERT to implement a hate speech and offensive language classifier. The model is trained on the Hate Speech and Offensive Language Dataset and can classify tweets into three classes:
19
+
20
+ 0. Hate speech
21
+ 1. Offensive language
22
+ 2. Neither
23
+
24
+
25
+ ## Prerequisites
26
+ Make sure you have the following Python packages installed:
27
+
28
+ - gradio
29
+ - tensorflow
30
+ - tensorflow_hub
31
+ - tensorflow_text
32
+
33
+
34
+ You can install all them using `makefile`. The `make pip-compile` command automatically creates a `virtualenv` and installs everything in `requirements.txt`:
35
+
36
+ ```bash
37
+ make pip-compile
38
+ ```
39
+
40
+ ## How to run the project
41
+ Simply run the provided Python script in your preferred Python environment. The script will create a web interface using Gradio so you can input text and receive predictions from the model.
42
+
43
+ ```bash
44
+ gradio app.py
45
+ ```
46
+
47
+ ## Usage
48
+ Once you have launched the app, simply enter a sentence in the textbox and press Enter. The model will classify the sentence into one of the three classes mentioned above and display the confidence for each class.
49
+
50
+ ## Jupyter Notebooks
51
+
52
+ - [`hate_speech_bert_bert_mlp_in_tensorflow.ipynb`](./hate_speech_bert_bert_mlp_in_tensorflow.ipynb): You can see how the model was trained
53
+ - [`hate_speech_run.ipynb`](./hate_speech_run.ipynb): Example of model execution
54
+
55
+
56
+ ## References and Resources
57
+ This project is based on:
58
+
59
+ - Classify text with BERT. (s. f.). TensorFlow. https://www.tensorflow.org/text/tutorials/classify_text_with_bert
60
+ - Devlin, J., Chang, M., Lee, K., & Toutanova, K. (2018). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv (Cornell University). https://arxiv.org/pdf/1810.04805v2
61
+ - G. (2021, 3 febrero). Hate Speech - BERT+CNN and BERT+MLP in Tensorflow. Kaggle. https://www.kaggle.com/code/giovanimachado/hate-speech-bert-cnn-and-bert-mlp-in-tensorflow
62
+ - Hate Speech and Offensive Language Dataset. (2020, 17 junio). Kaggle. https://www.kaggle.com/mrmorj/hate-speech-and-offensive-language-dataset
63
+
64
+
65
+