Download brain_lab/backend/emotion_study.py from Chungulus/brain-lab: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/spaces/Chungulus/brain-lab/resolve/main/brain_lab/backend/emotion_study.py
- Command line
-
hf download hf://spaces/Chungulus/brain-lab/brain_lab/backend/emotion_study.py
-
curl -L -o emotion_study.py https://huggingface.co/spaces/Chungulus/brain-lab/resolve/main/brain_lab/backend/emotion_study.py
1.66 kB
| """Curator-provided clip categories, kept separate from TRIBE predictions.""" | |
| EMOTIONS=[ | |
| {'id':'amusement','label':'Amusement / funny','example':'A short comedy moment or harmless visual gag.'}, | |
| {'id':'joy','label':'Joy / happiness','example':'A reunion, celebration, or shared success.'}, | |
| {'id':'calm','label':'Calm / peaceful','example':'Gentle nature footage with quiet music or natural sound.'}, | |
| {'id':'awe','label':'Awe / wonder','example':'A striking landscape, space scene, or impressive performance.'}, | |
| {'id':'fear','label':'Fear / suspense','example':'A tense scene with a suspenseful soundtrack.'}, | |
| {'id':'sadness','label':'Sadness','example':'A moving farewell or gentle, sad scene.'}, | |
| {'id':'anger','label':'Anger / frustration','example':'An unfair situation, conflict, or frustrating setback.'}, | |
| {'id':'disgust','label':'Disgust','example':'An unpleasant food or messy scene without graphic content.'}, | |
| {'id':'mixed','label':'Mixed / uncertain','example':'A scene that blends feelings or is hard to categorize.'}, | |
| {'id':'neutral','label':'Neutral / reference','example':'An ordinary scene for comparison.'}, | |
| ] | |
| SOURCE='https://doi.org/10.1073/pnas.1702247114' | |
| def label(title='',emotion='mixed'): | |
| choice=next((e for e in EMOTIONS if e['id']==emotion),None) | |
| if choice is None:raise ValueError('Choose a listed intended emotion.') | |
| title=' '.join(str(title).split()) | |
| if len(title)>120:raise ValueError('Use a clip title under 120 characters.') | |
| return {'title':title or 'My clip','intended_emotion':emotion,'emotion_label':choice['label'], | |
| 'label_source':'chosen by the clip curator','predicted_by_tribe':False} | |