Spaces:
Sleeping
Sleeping
| from transformers import pipeline | |
| # Load a BERT emotion classifier | |
| emotion_classifier = pipeline( | |
| "text-classification", | |
| model="j-hartmann/emotion-english-distilroberta-base", | |
| return_all_scores=False, | |
| top_k = 1 | |
| ) | |
| def mood_predict(text: str): | |
| preds = emotion_classifier(text)[0] | |
| print(preds) | |
| return preds[0] # return dict like content | |