Giter Site home page Giter Site logo

company-sentiment-analysis's Introduction

sentiments


Company-Sentiment-Analysis

This is a Streamlit app for sentiment analysis that uses XLM RoBERTa model on Hugging Face. The program scrapes twitter for tweets that are about a certain company. The tweets are then fed into a model for sentiment analysis.

  • You can find our CUSTOM MODEL in this repo here

Interface

Below is a video demo of the app.

Preview.mp4

Installation

To be able to use this app, please follow the instructions below. First, you need to install requirements using the following command.

pip install -r requirements.txt

After that, you need to download this model from Hugging Face.

from transformers import pipeline
import tokenizers
# this will download 2 GB
nlp = pipeline("sentiment-analysis", model='akhooli/xlm-r-large-arabic-sent')

# Save it in the same app folder
# .save_pretrained(path)
# 'XLM-R-L-ARABIC-SENT' is the folder name of the model
nlp.save_pretrained('XLM-R-L-ARABIC-SENT')

This will produce a folder that has the model. Please include the folder in the same directory as 'app.py'.
In case you want to replace this model with another, you want to download your model and edit the setup_model() function. Implementation is shown below.

def setup_model():
    """
    Setup Model
    """
    #*************************************************
    #  -==EDIT THE LINE BELOW WITH YOUR OWN MODEL==-
    #*************************************************
    nlp = pipeline("sentiment-analysis", model='XLM-R-L-ARABIC-SENT')
    return nlp

Now to run the app, just simply run the command below in a terminal.

streamlit run app.py

How to use?

Below you can find all the settings you can tweak that are related to your query.

sentiments

If the program was unable to find enough tweets for a given query then the message below will show.

image

WordCloud is not available for Arabic due to the library not being compatable with Arabic.

About

This Streamlit app was developed as part of my Data Scientist intern position at Banque Misr.

company-sentiment-analysis's People

Contributors

fahdseddik 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.