Priyam1105/Sentiment_analysis_pro
0
๐ฏ Sentiment Analysis API
A production-ready FastAPI application for service review sentiment analysis powered by a fine-tuned DistilBERT model.
Model Details
- Base Model:
distilbert-base-uncased - Task: Sequence Classification (3 classes)
- Labels:
positive,neutral,negative - Training Data: Amazon service reviews + synthetic service review data
API Endpoints
Quick Start (Local)
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 7860 --reloadExample API Usage
import requests
response = requests.post(
"http://localhost:7860/predict",
json={"text": "The plumber was very professional and on time"}
)
print(response.json())
# {"text": "...", "sentiment": "positive", "confidence": 0.98, "raw_label": "LABEL_2"}Deploy to Hugging Face Spaces
- Create a new Space on Hugging Face
- Select Docker as the SDK
- Push this entire repository to the Space
- The app will build and deploy automatically
Tech Stack
- FastAPI โ High-performance async API framework
- Hugging Face Transformers โ DistilBERT model inference
- PyTorch โ Deep learning backend
- Pydantic โ Request/response validation
