Update app.py
Browse files
app.py
CHANGED
@@ -24,13 +24,11 @@ def get_top_emojis(text, top_n=TOP_N):
|
|
24 |
scores = torch.nn.functional.softmax(preds, dim=-1).detach().numpy()
|
25 |
ranking = np.argsort(scores)
|
26 |
print(ranking)
|
27 |
-
ranking = ranking
|
28 |
print(scores)
|
29 |
print(ranking)
|
30 |
print(model.config.id2label)
|
31 |
-
for i in ranking
|
32 |
-
print(model.config.id2label[i])
|
33 |
-
emojis = []
|
34 |
return emojis
|
35 |
|
36 |
|
|
|
24 |
scores = torch.nn.functional.softmax(preds, dim=-1).detach().numpy()
|
25 |
ranking = np.argsort(scores)
|
26 |
print(ranking)
|
27 |
+
ranking = ranking.squeeze()[::-1][:top_n]
|
28 |
print(scores)
|
29 |
print(ranking)
|
30 |
print(model.config.id2label)
|
31 |
+
emojis = [model.config.id2label[i] for i in ranking]
|
|
|
|
|
32 |
return emojis
|
33 |
|
34 |
|