Spaces:
Running
Running
path to model change
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ from transformers import AutoModel, AutoTokenizer
|
|
14 |
model_name = "Pendrokar/TorchMoji"
|
15 |
model = AutoModel.from_pretrained(model_name, cache_dir="~/.cache/huggingface/hub/")
|
16 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
17 |
-
model_path =
|
18 |
vocab_path = './' + model_name + "/vocabulary.json"
|
19 |
|
20 |
def top_elements(array, k):
|
@@ -29,7 +29,7 @@ model = torchmoji_emojis(model_path)
|
|
29 |
|
30 |
def predict(deepmoji_analysis):
|
31 |
output_text = "\n"
|
32 |
-
tokenized, _, _ = st.tokenize_sentences(
|
33 |
prob = model(tokenized)
|
34 |
|
35 |
for prob in [prob]:
|
@@ -37,7 +37,7 @@ def predict(deepmoji_analysis):
|
|
37 |
# correspond to the mapping in emoji_overview.png
|
38 |
# at the root of the torchMoji repo.
|
39 |
scores = []
|
40 |
-
for i, t in enumerate(
|
41 |
t_tokens = tokenized[i]
|
42 |
t_score = [t]
|
43 |
t_prob = prob[i]
|
|
|
14 |
model_name = "Pendrokar/TorchMoji"
|
15 |
model = AutoModel.from_pretrained(model_name, cache_dir="~/.cache/huggingface/hub/")
|
16 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
17 |
+
model_path = "~/.cache/huggingface/hub/pytorch_model.bin"
|
18 |
vocab_path = './' + model_name + "/vocabulary.json"
|
19 |
|
20 |
def top_elements(array, k):
|
|
|
29 |
|
30 |
def predict(deepmoji_analysis):
|
31 |
output_text = "\n"
|
32 |
+
tokenized, _, _ = st.tokenize_sentences([deepmoji_analysis])
|
33 |
prob = model(tokenized)
|
34 |
|
35 |
for prob in [prob]:
|
|
|
37 |
# correspond to the mapping in emoji_overview.png
|
38 |
# at the root of the torchMoji repo.
|
39 |
scores = []
|
40 |
+
for i, t in enumerate([deepmoji_analysis]):
|
41 |
t_tokens = tokenized[i]
|
42 |
t_score = [t]
|
43 |
t_prob = prob[i]
|