Pendrokar commited on
Commit
b32681b
1 Parent(s): b48129e

add emojis

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -10,6 +10,7 @@ import numpy as np
10
 
11
  from torchmoji.sentence_tokenizer import SentenceTokenizer
12
  from torchmoji.model_def import torchmoji_emojis
 
13
 
14
  from huggingface_hub import hf_hub_download
15
 
@@ -50,7 +51,12 @@ def predict(deepmoji_analysis, emoji_count):
50
  ind_top_ids = top_elements(t_prob, emoji_count)
51
 
52
  for ind in ind_top_ids:
53
- return_label[emoji_codes[str(ind)]] = t_prob[ind]
 
 
 
 
 
54
 
55
  return return_label
56
 
 
10
 
11
  from torchmoji.sentence_tokenizer import SentenceTokenizer
12
  from torchmoji.model_def import torchmoji_emojis
13
+ from emoji import emojize
14
 
15
  from huggingface_hub import hf_hub_download
16
 
 
51
  ind_top_ids = top_elements(t_prob, emoji_count)
52
 
53
  for ind in ind_top_ids:
54
+ # unicode emoji + :alias:
55
+ label_emoji = emojize(emoji_codes[str(ind)], language="alias")
56
+ label_name = label_emoji + emoji_codes[str(ind)]
57
+ # propability
58
+ label_prob = t_prob[ind]
59
+ return_label[label_name] = label_prob
60
 
61
  return return_label
62