santit96's picture
Update README with .env instructions
f4e4793
|
raw
history blame
1.31 kB
metadata
title: Sentiment classificator
emoji: 🎭
colorFrom: blue
colorTo: red
sdk: streamlit
sdk_version: 1.25.0
pinned: false
app_file: sentiment_analysis.py

bert-sentiment-analysis

Prototype that classifies text into positive or negative sentiments using a fine tuned bert model

Installation of dependencies

pip install -r requirements.txt

Usage

  1. Download the trained model and move it to the models directory
  2. Create a .env file and set a MODEL_NAME property with the name of the trained model file and optionally a MODEL_REPOSITORY_NAME property with the name of the huggingface repository of the model.
  3. Use the tool:
  • To use it as a streamlit web app run:

    streamlit run sentiment_analysis.py

    It will open a web app on http://localhost:8501

  • To use it from command line run

    python sentiment_classificator.py <TEXT_TO_CLASSIFY>

Training

  1. Download the all_sentiment_dataset.csv
  2. Execute the classify_sentiment_with_bert notebook which is in the notebooks directory
  3. The model should be saved under models directory as sentiments_bert_model.h5