11 lines
432 B
Python
11 lines
432 B
Python
from transformers import AutoTokenizer
|
|
from transformers import pipeline
|
|
|
|
model = 'application/models/sentiment_model'
|
|
tokenizer = AutoTokenizer.from_pretrained('application/tokenizers/sentiment_tokenizer')
|
|
# tokenizer = AutoTokenizer.from_pretrained("sdadas/polish-gpt2-small")
|
|
|
|
def sentiment_prediction(data):
|
|
pipe = pipeline('text-classification', model=model, tokenizer = tokenizer)
|
|
result = pipe(data)
|
|
return result |