Spaces:
Sleeping
Sleeping
| import numpy as np | |
| EMOTIONS = ["angry", "happy", "sad", "neutral"] | |
| def simple_rule_classifier(features): | |
| pitch = features[-2] | |
| energy = features[-1] | |
| # Basic heuristics (you can improve later) | |
| if energy > 0.1 and pitch > 150: | |
| return "happy", 0.7 | |
| elif energy > 0.15 and pitch < 120: | |
| return "angry", 0.7 | |
| elif energy < 0.05: | |
| return "sad", 0.7 | |
| else: | |
| return "neutral", 0.6 |