File size: 478 Bytes
e548193 2a7bc10 e548193 3dd6930 e548193 2a7bc10 e548193 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# model.py
from transformers import AutoModelForSequenceClassification, AutoTokenizer
class Model:
"""A model class to lead the model and tokenizer"""
def __init__(self) -> None:
pass
def load_model():
model = AutoModelForSequenceClassification.from_pretrained('cardiffnlp/twitter-roberta-base-sentiment')
return model
def load_tokenizer():
tokenizer = AutoTokenizer.from_pretrained("cardiffnlp/twitter-roberta-base-sentiment")
return tokenizer |