dileepa's picture
Create README.md
8be8cd2 verified
|
Raw History Blame Contribute Delete
763 Bytes
# Hate Speech Classification Model Guide
## Introduction
This document provides instructions for importing and using the hate speech classification model from Hugging Face in a Google Colab environment.
---
## Steps for Setup
### 1. Import Necessary Libraries
```python
import tensorflow as tf
import tensorflow_hub as hub
```
### 2. Clone the Model Repository
`!git clone https://huggingface.co/dileepa/hate_speech_classification`
### 3. Load the Pre-trained Model
```
cnn_model = tf.keras.models.load_model(
'hate_speech_classification/model.h5',
custom_objects={'KerasLayer': hub.KerasLayer}
)
```
### 4. Example Usage
```
# Test prediction
sample_text = "Insert your text here"
result = cnn_model.predict([sample_text])
print(result)
```