Project
Emotion Detection API
Emotion Detection API is a Flask web application that analyzes English text with the Watson NLP EmotionPredict service and reports the dominant emotion.
FinishedSource code (opens in a new tab)
- Category
- AI Application
- Started
- Sep 2026
- Language
- Python
Stack
- Python
- Flask
- Watson NLP
- NLP
- AI
- Emotion Detection
- REST API
About this project
Text submitted in the browser is sent to a Flask endpoint, which calls Watson NLP and extracts scores for anger, disgust, fear, joy, and sadness. The highest score becomes the dominant emotion shown to the user.
Features
- Browser interface for submitting text
- HTTP endpoint that returns all five emotion scores
- Dominant-emotion calculation from the returned scores
- Handling for blank or invalid input
- Unit test cases for each of the five emotions
Purpose
- Integrate an AI/NLP service into a Python web application
- Package the analysis logic as a reusable Python module
- Practice error handling and unit testing around an external API
Scope & Limitations
- Depends on the hosted Watson NLP service being reachable
- English text only
- The test file's import line needs fixing before the tests can run
- Runs on the Flask development server; no production deployment configuration
Tech Stack
- Backend: Python, Flask, Requests
- AI: Watson NLP EmotionPredict
- Frontend: HTML, JavaScript, Bootstrap
- Testing: unittest
Notes
- Built on an IBM Developer Skills Network course starter repository.
- Source code: https://github.com/Felipeact/emotion-detection-api