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.
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.
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
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
Scope
- 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
Notes
Built on an IBM Developer Skills Network course starter repository.