GithubHelp home page GithubHelp logo

moris-polanco / twitter-sentiment-analysis-web-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from agrawal-rohit/tweet-sense

0.0 0.0 0.0 13.7 MB

Sentiment analysis dashboard for Twitter hashtags

JavaScript 9.88% Python 5.83% CSS 3.15% HTML 3.39% Jupyter Notebook 75.67% Dockerfile 2.08%

twitter-sentiment-analysis-web-app's Introduction

twitter-sentiment-analysis-web-app


App

This is a web app which can be used to analyze users' sentiments across Twitter hashtags/terms. Its created using React and Django and uses an LSTM model trained on the Kaggle Sentiment140 dataset and served as a REST API to the ReactJS frontend.

The server pulls tweets using tweepy and performs inference using Keras. It also pulls data from the Wikipedia API based the hashtag chosen to display a short description. As part of the analysis, I also added few examples of the tweets and their predicted sentiments. A kernel for another sentiment classification using a CNN + 1D pooling can be found here

Untitled Diagram (6)

How to Use

Running the application

  1. Download the trained model and put into the server/main folder
    (Note: This is the CNN model. f you want use the LSTM model, you'll need to follow the training steps below and put the saved model in server/main. Also, don't forget to change the loaded model name in server/main/init.py )

  2. Get your Twitter API credentials through Keys and Tokens tab under the Twitter Developer Portal Projects & Apps page and add them to the /server/main/config.py file.

  3. Run docker-compose up --build in the terminal from the root folder
    (Note: Ensure that you have Docker installed)

  4. Open http://localhost:5000 in your browser to access the app

Training the model

(Note: If you have a GPU in your system, I suggest that you train the CNN model. The LSTM model takes longer to train due to its sequential nature, and offer relatively similar performance)

CNN Model

  1. Copy and run the Kaggle Notebook.

LSTM Model

  1. Download the Kaggle Sentiment140 dataset and put it in the root folder as sentiment140.csv.
  2. Run the code blocks given in the Twitter Sentiment Analysis.ipynb

twitter-sentiment-analysis-web-app's People

Contributors

agrawal-rohit avatar dependabot[bot] 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.