File size: 1,108 Bytes
1eb51e0 93109de 18464de 1eb51e0 18464de |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
---
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](https://huggingface.co/rootstrap-org/bert-sentiment-classifier/blob/main/sentiments_bert_model.h5) and move it to the *models* directory
2. 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](https://drive.google.com/file/d/175Ccd3B6kLWMBvr1WAUzQJT4TwgzXF6N/view?usp=sharing)
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**
|