A RESTful API for sentiment analysis built with FastAPI. It predicts the sentiment (positive/negative) of a given text.
- Predict sentiment from text input
- FastAPI-based web server
- Easy to deploy with Uvicorn
- Ready for Docker deployment
pip install -e .
pip install -e '.[lint]'
pre-commit run --all-files
pip install -e '.[test]'
pytest -sxv tests/
uvicorn oc_sentiment_ml_api.main:app --host 0.0.0.0 --port 8000
curl -X POST "http://localhost:8000/predict" -H "Content-Type: application/json" -d '{"text": "I love this product!"}'
Response:
{
"sentiment": "positive",
"confidence": 0.98
}
Pull requests are welcome! Please open an issue first to discuss changes.
MIT License