CoolFace
Apppublic

haripriyaram/emotion-classifier-Microservice

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

Emotion Classifier Microservice

This microservice exposes a FastAI emotion classification model via a FastAPI REST API.

Service Description

  • —Input: JSON with a text field (string) containing the text to classify.
  • —Output: JSON with the predicted emotion (string) and confidence (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

  1. 1.Place emotion_classifier.pkl in this directory.
  2. 2.Install dependencies:
   pip install -r requirements.txt
  1. 1.Start the service:
   uvicorn main:app --host 0.0.0.0 --port 8000
  1. 1.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.