File size: 514 Bytes
e548193
 
 
 
 
 
 
 
 
 
3dd6930
e548193
 
 
3dd6930
e548193
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# model.py
from transformers import AutoModelForSequenceClassification, TFAutoModelForSequenceClassification, AutoTokenize

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 = AutoTokenize.from_pretrained("cardiffnlp/twitter-roberta-base-sentiment")
    return tokenizer