avichr commited on
Commit
6dd4d02
·
1 Parent(s): 53f1934

Update HebEMO.py

Browse files
Files changed (1) hide show
  1. HebEMO.py +3 -4
HebEMO.py CHANGED
@@ -1,5 +1,5 @@
1
  class HebEMO:
2
- def __init__(self, device=0, emotions = ['expectation', 'happy', 'trust', 'fear', 'surprise', 'anger',
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="../hebEMO/"+emo+'_classifier',
16
- tokenizer="../heBERT_base_oscar",
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])