Spaces:
Runtime error
Runtime error
File size: 368 Bytes
3efdb8d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from transformers import pipeline
import numpy as np
specific_model = pipeline(model="finiteautomata/bertweet-base-sentiment-analysis")
def Sentiment(tweets):
output_model = specific_model(tweets.tolist())
labels = ["NEG","NEU","POS"]
idx = []
for output in output_model:
idx.append(labels.index(output["label"])-1)
return np.array(idx)
|