Coder Social home page Coder Social logo

soumya-prabha-maiti / hate-speech-classification Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 46 KB

A project to classify the input text as hate speech or not using an LSTM model trained on the Hate Speech and Offensive Language dataset and Twitter hate speech dataset from Kaggle.

Home Page: https://huggingface.co/spaces/soumyaprabhamaiti/hate_speech_classifier

License: MIT License

Python 11.76% Jupyter Notebook 88.24%
deep-learning gradio huggingface-spaces machine-learning nlp python tensorflow

hate-speech-classification's Introduction

title emoji colorFrom colorTo sdk sdk_version app_file pinned license
Hate Speech Classifier
๐Ÿ“Š
gray
blue
gradio
3.42.0
app.py
false
mit

Hate Speech Classification

Hugging Face Spaces

A project to classify the input text as hate speech or not using an LSTM model trained on the Hate Speech and Offensive Language dataset and Twitter hate speech dataset from Kaggle.

Demo

The deployed version of this project can be accessed at Hugging Face Spaces. A demo of the app is shown below:

Demo of the app

Dataset

The dataset used in this project is a combination of the Hate Speech and Offensive Language dataset and Twitter hate speech dataset. The combined dataset contains 56,745 tweets belonging to 3 classes: hate speech, offensive language, and neither, among which the first two are merged to form the final hate speech class. The modified dataset thus formed is an almost balanced dataset with 2 classes - hate speech and not a hate speech. The dataset is split into 80% training and 20% validation sets.

Model Architecture

The model used in this project is a simple LSTM model with an embedding layer, a dropout layer and a dense layer.

The detailed architecture of the model used in this project is shown below:

Model: "sequential"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 embedding (Embedding)       (None, 300, 100)          5000000   
                                                                 
 spatial_dropout1d (SpatialD  (None, 300, 100)         0         
 ropout1D)                                                       
                                                                 
 lstm (LSTM)                 (None, 100)               80400     
                                                                 
 dense (Dense)               (None, 1)                 101       
                                                                 
=================================================================
Total params: 5,080,501
Trainable params: 5,080,501
Non-trainable params: 0
_________________________________________________________________

Libraries Used

The following libraries were used in this project:

  • TensorFlow: To build segmentation model.
  • Gradio: To create the user interface for the segmentation app.

Installing Locally

To run this project locally, please follow these steps:

  1. Clone the repository:

    git clone https://github.com/soumya-prabha-maiti/hate-speech-classification
    
  2. Navigate to the project folder:

    cd hate-speech-classification
    
  3. Install the required libraries:

    pip install -r requirements.txt
    
  4. Run the application:

    python app.py
    
  5. Access the application in your web browser at the specified port.

License

This project is licensed under the MIT License.

hate-speech-classification's People

Contributors

soumya-prabha-maiti avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.