Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,10 +45,11 @@ def sentiment_analysis(sentence, model_name):
|
|
| 45 |
# for t in translated:
|
| 46 |
# print( tokenizer.decode(t, skip_special_tokens=True) )
|
| 47 |
|
| 48 |
-
output = [sentence ['translation_text'] for sentence in tokenizer.decode(translated_tokens, skip_special_tokens=True)]
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
# output = nlp(sentences)
|
| 52 |
|
| 53 |
# testdata = []
|
| 54 |
# for i,sentence in enumerate(sentences):
|
|
@@ -84,7 +85,7 @@ def sentiment_analysis(sentence, model_name):
|
|
| 84 |
# logits = prompt_model(inputs)
|
| 85 |
# result.extend(torch.argmax(logits, dim=-1))
|
| 86 |
# output = '\n'.join([classes[i] for i in result])
|
| 87 |
-
return output
|
| 88 |
|
| 89 |
|
| 90 |
|
|
|
|
| 45 |
# for t in translated:
|
| 46 |
# print( tokenizer.decode(t, skip_special_tokens=True) )
|
| 47 |
|
| 48 |
+
# output = [sentence ['translation_text'] for sentence in tokenizer.decode(translated_tokens, skip_special_tokens=True)]
|
| 49 |
+
for t in translated_tokens:
|
| 50 |
+
output.append(tokenizer.decode(t, skip_special_tokens=True)))
|
| 51 |
|
| 52 |
+
|
|
|
|
| 53 |
|
| 54 |
# testdata = []
|
| 55 |
# for i,sentence in enumerate(sentences):
|
|
|
|
| 85 |
# logits = prompt_model(inputs)
|
| 86 |
# result.extend(torch.argmax(logits, dim=-1))
|
| 87 |
# output = '\n'.join([classes[i] for i in result])
|
| 88 |
+
return str(output)
|
| 89 |
|
| 90 |
|
| 91 |
|