Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 1.36 KB

File metadata and controls

66 lines (45 loc) · 1.36 KB

Deploy BERT for Sentiment Analsysi with FastAPI

Deploy a pre-trained BERT model for Sentiment Analysis as a REST API using FastAPI

Demo

The model is trained to classify sentiment (negative, neutral, and positive) on a custom dataset from app reviews on Google Play. Here's a sample request to the API:

http POST http://127.0.0.1:8000/predict text="Good basic lists, i would like to create more lists, but the annual fee for unlimited lists is too out there"

The response you'll get looks something like this:

{
    "confidence": 0.9999083280563354,
    "probabilities": {
        "negative": 3.563107020454481e-05,
        "neutral": 0.9999083280563354,
        "positive": 5.596495248028077e-05
    },
    "sentiment": "neutral"
}

You can also read the complete tutorial here

Installation

Clone this repo:

git clone [email protected]:curiousily/Deploy-BERT-for-Sentiment-Analysis-with-FastAPI.git
cd Deploy-BERT-for-Sentiment-Analysis-with-FastAPI

Install the dependencies:

pipenv install --dev

Download the pre-trained model:

bin/download_model

Test the setup

Start the HTTP server:

bin/start_server

Send a test request:

bin/test_request

License

MIT