Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/curiousily/Deploy-BERT-for-Sentiment-Analysis-with-FastAPI
Deploy BERT for Sentiment Analysis as REST API using FastAPI, Transformers by Hugging Face and PyTorch
https://github.com/curiousily/Deploy-BERT-for-Sentiment-Analysis-with-FastAPI
bert deep-learning deploy-machine-learning deployment fastapi huggingface huggingface-transformer machine-learning python pytorch rest rest-api sentiment-analysis transformers uvicorn
Last synced: 3 months ago
JSON representation
Deploy BERT for Sentiment Analysis as REST API using FastAPI, Transformers by Hugging Face and PyTorch
- Host: GitHub
- URL: https://github.com/curiousily/Deploy-BERT-for-Sentiment-Analysis-with-FastAPI
- Owner: curiousily
- License: mit
- Created: 2020-04-26T08:35:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T09:42:11.000Z (almost 2 years ago)
- Last Synced: 2024-06-03T09:47:10.224Z (5 months ago)
- Topics: bert, deep-learning, deploy-machine-learning, deployment, fastapi, huggingface, huggingface-transformer, machine-learning, python, pytorch, rest, rest-api, sentiment-analysis, transformers, uvicorn
- Language: Python
- Homepage: https://www.curiousily.com/posts/deploy-bert-for-sentiment-analysis-as-rest-api-using-pytorch-transformers-by-hugging-face-and-fastapi/
- Size: 86.9 KB
- Stars: 190
- Watchers: 4
- Forks: 58
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - curiousily/Deploy-BERT-for-Sentiment-Analysis-with-FastAPI - Deploy BERT for Sentiment Analysis as REST API using FastAPI, Transformers by Hugging Face and PyTorch (Python)
README
# 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:
```bash
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:
```js
{
"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](https://www.curiousily.com/posts/deploy-bert-for-sentiment-analysis-as-rest-api-using-pytorch-transformers-by-hugging-face-and-fastapi/)
## Installation
Clone this repo:
```sh
git clone [email protected]:curiousily/Deploy-BERT-for-Sentiment-Analysis-with-FastAPI.git
cd Deploy-BERT-for-Sentiment-Analysis-with-FastAPI
```Install the dependencies:
```sh
pipenv install --dev
```Download the pre-trained model:
```sh
bin/download_model
```## Test the setup
Start the HTTP server:
```sh
bin/start_server
```Send a test request:
```sh
bin/test_request
```## License
MIT