Skip to content

Streamlit app for company sentiment analysis based on tweets.

Notifications You must be signed in to change notification settings

FahdSeddik/Company-Sentiment-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Streamlit app for company sentiment analysis based on tweets.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages