BasuDevTyagi10 / offensive-tweet-detection

work done for miniproject evaluation GEU Semester-4 on Detecting Offensive Content on Social Media

Home Page:https://offensive-tweet-detector.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OFFENSIVE TWEET DETECTION WEB-APP

Table of Contents

-> General Info
-> Technologies
-> Getting Started
-> Authors

General Info

Project Purpose : work done for miniproject evaluation GEU Semester-4

Project Directory :

 ./model-training-&-testing : contains the dataset csv files, jupyter notebook and pickle files. The jupyter notebook is used for Data Visualization, Data Cleaning and Model Training, Testing & Exporting (for using it in our Web-App)
 ./web-app : contains the files for Flask Application (deployed on Heroku server - link to App).

Technologies

The project is created using :

  • Python 3.8.8
  • Flask 1.1.2
  • HTML5 and CSS
  • Bootstrap v5.0
  • Heroku

Getting Started

Clone the repo on local machine:

$ git clone https://github.com/BasuDevTyagi10/offensive-tweet-detection.git
$ cd "offensive-tweet-detection"

Create a virtual environment (for better control (version control) over the project)

It is better to use Anaconda Navigator (Anaconda Documentation - Installation) for handling such (and further mentioned) tasks of creating virtual environments, installing packages, IDEs, Applications, etc.

For performing the mentioned operations manually (without Anaconda) :

Install virtualenv module to create isolated virtual environments.

$ pip install virtualenv

To create a Virtual Environment for Python 2.x do the following

$ virtualenv myenv

For a Python 3 virtual environment type –

$ python3 -m venv myenv

To activate the virtual environment -
On Windows, run:

$ myenv\Scripts\activate.bat

Installing required packages

The following packages will be required to be installed for running the 4thSemProject.ipynb jupyter notebook:
jupyterlab, pandas-profiling, pandas, matplotlib, unidecode, wordcloud, plotly and scikit-learn
And the following for running the Flask web-app in development mode on localhost (Port:5000):
flask, pandas and unidecode

Install the above mentioned packages in your virtual environment using Anaconda, and without it by:
run the below command after you're in your virtual environment

(myenv)$ pip install jupyterlab pandas-profiling pandas matplotlib unidecode wordcloud plotly scikit-learn

Run Jupyter Notebook for Data Analysis and to get a Trained Machine Learning Model

Once installed, launch JupyterLab with:

(myenv)$ cd model-training-&-testing
(myenv)$ jupyter-lab

Open the 4thSemProject.ipynb jupyter notebook and Run All the Cells.
The notebook will create 3 files, clean_traindata.csv, trained_model.pickle and vectorizer.pickle.
Move trained_model.pickle and vectorizer.pickle to the web-app directory.
Windows:

(myenv)$ move trained_model.pickle ../web-app
(myenv)$ move vectorizer.pickle ../web-app

Run the Flask Web-App to test the Trained Machine Learning Model

Switch to web-app directory

(myenv)$ cd ../web-app

run the below command:

(myenv)$ python app.py

to run the app in the development mode.
Open http://localhost:5000 to view it in the browser.

Authors

About

work done for miniproject evaluation GEU Semester-4 on Detecting Offensive Content on Social Media

https://offensive-tweet-detector.herokuapp.com/


Languages

Language:Jupyter Notebook 99.8%Language:HTML 0.1%Language:Python 0.1%