Spaces:
Runtime error
Runtime error
Update HebEMO.py
Browse files
HebEMO.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
class HebEMO:
|
2 |
-
def __init__(self, device=0, emotions = ['
|
3 |
'sadness', 'disgust']):
|
4 |
|
5 |
from transformers import pipeline
|
@@ -12,8 +12,8 @@ class HebEMO:
|
|
12 |
for emo in tqdm(emotions):
|
13 |
self.hebemo_models[emo] = pipeline(
|
14 |
"sentiment-analysis",
|
15 |
-
model="
|
16 |
-
tokenizer="
|
17 |
device = self.device #run on GPU
|
18 |
)
|
19 |
|
@@ -73,7 +73,6 @@ class HebEMO:
|
|
73 |
hebEMO = pd.DataFrame()
|
74 |
for emo in hebEMO_df.columns[1::2]:
|
75 |
hebEMO[emo] = abs(hebEMO_df[emo]-(1-hebEMO_df['confidence_'+emo]))
|
76 |
-
hebEMO = hebEMO.rename(columns= {'happy': 'joy', 'expectation':'anticipation'})
|
77 |
|
78 |
for i in range(0,1):
|
79 |
ax = plutchik(hebEMO.to_dict(orient='records')[i])
|
|
|
1 |
class HebEMO:
|
2 |
+
def __init__(self, device=0, emotions = ['anticipation', 'joy', 'trust', 'fear', 'surprise', 'anger',
|
3 |
'sadness', 'disgust']):
|
4 |
|
5 |
from transformers import pipeline
|
|
|
12 |
for emo in tqdm(emotions):
|
13 |
self.hebemo_models[emo] = pipeline(
|
14 |
"sentiment-analysis",
|
15 |
+
model="avichr/hebEMO_"+emo,
|
16 |
+
tokenizer="avichr/heBERT",
|
17 |
device = self.device #run on GPU
|
18 |
)
|
19 |
|
|
|
73 |
hebEMO = pd.DataFrame()
|
74 |
for emo in hebEMO_df.columns[1::2]:
|
75 |
hebEMO[emo] = abs(hebEMO_df[emo]-(1-hebEMO_df['confidence_'+emo]))
|
|
|
76 |
|
77 |
for i in range(0,1):
|
78 |
ax = plutchik(hebEMO.to_dict(orient='records')[i])
|