get model and tokenizer from HuggingFace
This commit is contained in:
parent
14ebbba342
commit
38122a4cbf
@ -1,10 +1,13 @@
|
||||
from transformers import AutoTokenizer
|
||||
from transformers import pipeline
|
||||
from transformers import pipeline, GPT2ForSequenceClassification
|
||||
import re
|
||||
from facebook_scraper import get_posts
|
||||
|
||||
model = 'application/models/sentiment_model'
|
||||
tokenizer = AutoTokenizer.from_pretrained('application/tokenizers/sentiment_tokenizer')
|
||||
# model = 'application/models/sentiment_model'
|
||||
# tokenizer = AutoTokenizer.from_pretrained('application/tokenizers/sentiment_tokenizer')
|
||||
|
||||
model = GPT2ForSequenceClassification.from_pretrained("Scigi/sentiment-analysis-model", num_labels=3)
|
||||
tokenizer = AutoTokenizer.from_pretrained("Scigi/sentiment-analysis-model")
|
||||
|
||||
def sentiment_prediction(data):
|
||||
pipe = pipeline('text-classification', model=model, tokenizer = tokenizer)
|
||||
|
Loading…
Reference in New Issue
Block a user