Spaces:
Running
Running
johnpaulbin
commited on
Commit
•
ef6e6ca
1
Parent(s):
6bc2af2
Update app.py
Browse files
app.py
CHANGED
@@ -68,6 +68,8 @@ def deepmojify(sentence, top_n=5, prob_only=False):
|
|
68 |
tokenized = torch.tensor(tokenized).cuda() # then convert to PyTorch tensor
|
69 |
|
70 |
prob = emojimodel.forward(tokenized)[0]
|
|
|
|
|
71 |
if prob_only:
|
72 |
return prob
|
73 |
emoji_ids = top_elements(prob.cpu().numpy(), top_n)
|
|
|
68 |
tokenized = torch.tensor(tokenized).cuda() # then convert to PyTorch tensor
|
69 |
|
70 |
prob = emojimodel.forward(tokenized)[0]
|
71 |
+
if not USE_GPU:
|
72 |
+
prob = torch.tensor(prob)
|
73 |
if prob_only:
|
74 |
return prob
|
75 |
emoji_ids = top_elements(prob.cpu().numpy(), top_n)
|