Skip to content

helinatefera/Hate-Speech-Classification

Repository files navigation

💬 Hate Speech Classification (Logistic Regression)

Live Site

A simple Flask-based web application and API for classifying hate speech using a Logistic Regression model trained on TF-IDF vectorization.

Live

📦 Requirements


🚀 Running the Project

📁 Clone the Repository

Clone using SSH:

git clone git@github.com:helinatefera/Hate-Speech-Classification.git
cd Hate-Speech-Classification

⚙️ Installation (Local)

Clone the repository and install dependencies:

pip install -r requirements/local.txt

🧠 Training the Model

To train the model on the preprocessed dataset:

python3 train.py

This will generate a pipeline.joblib file that includes both the TF-IDF vectorizer and the trained classifier.


🔍 Running Predictions (CLI)

Once the model is trained, you can test it using:

python3 predict.py

You will get a response like:

Positive (non-hate) (0.95 confidence)

🌐 Web App & API

Run the Flask app:

python app/main_app.py

The app provides:


🐳 Docker Support

Build the Docker image:

docker build -t hate-speech-app .

Run the container:

docker run -d -p 8000:5000 hate-speech-app

Then visit:

http://localhost:8000

🔗 API Usage

GET

GET /api/predict?text=I love you

POST

POST /api/predict
Content-Type: application/json

{
  "text": "I hate you"
}

🧼 License

MIT License © helinatefera

📞 Contact

👤 Helina Tefera
✉️ E-Mail
📱 Phone

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors