haripriyaram/emotion-classifier-Microservice
0
Emotion Classifier Microservice
This microservice exposes a FastAI emotion classification model via a FastAPI REST API.
Service Description
- Input: JSON with a
textfield (string) containing the text to classify. - Output: JSON with the predicted
emotion(string) andconfidence(float between 0 and 1).
Example
Request
POST /predict
Content-Type: application/json
{
"text": "I am so happy today!"
}Response
{
"emotion": "joy",
"confidence": 0.98
}Public URL
Once deployed, your service will be available at:
<YOUR_PUBLIC_URL_HERE>Deployment Instructions
- Place
emotion_classifier.pklin this directory. - Install dependencies:
pip install -r requirements.txt- Start the service:
uvicorn main:app --host 0.0.0.0 --port 8000- Test locally:
curl -X POST "http://localhost:8000/predict" -H "Content-Type: application/json" -d '{"text": "I am so happy today!"}'Notes
- Make sure to update
<YOUR_PUBLIC_URL_HERE>after deployment (e.g., Railway, Hugging Face Spaces, Render, etc.). - Keep the service running and accessible until grading is complete.
