huggingface error model
This commit is contained in:
parent
176ba1c9ad
commit
66a0b1c6bc
@ -1,11 +1,12 @@
|
|||||||
from transformers import AutoTokenizer
|
from transformers import AutoTokenizer
|
||||||
from transformers import pipeline
|
from transformers import pipeline
|
||||||
|
#from transformers import BartForConditionalGeneration
|
||||||
|
|
||||||
# model = 'application/models/errors_model'
|
tokenizer = AutoTokenizer.from_pretrained("szymonj/polish-simple-error-correction")
|
||||||
# tokenizer = AutoTokenizer.from_pretrained('application/tokenizers/errors_tokenizer')
|
#model = BartForConditionalGeneration.from_pretrained("szymonj/polish-simple-error-correction")
|
||||||
|
pipe = pipeline("text2text-generation",model="szymonj/polish-simple-error-correction",tokenizer=tokenizer,max_length=2000)
|
||||||
|
|
||||||
def errors_correction(data):
|
def errors_correction(data):
|
||||||
pipe = pipeline("text2text-generation",model=model,tokenizer=tokenizer,max_length=2000)
|
|
||||||
result = pipe(data)
|
result = pipe(data)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -6,11 +6,11 @@ from facebook_scraper import get_posts
|
|||||||
# model = 'application/models/sentiment_model'
|
# model = 'application/models/sentiment_model'
|
||||||
# tokenizer = AutoTokenizer.from_pretrained('application/tokenizers/sentiment_tokenizer')
|
# tokenizer = AutoTokenizer.from_pretrained('application/tokenizers/sentiment_tokenizer')
|
||||||
|
|
||||||
model = GPT2ForSequenceClassification.from_pretrained("Scigi/sentiment-analysis-model", num_labels=3)
|
#model = GPT2ForSequenceClassification.from_pretrained("Scigi/sentiment-analysis-model", num_labels=3)
|
||||||
tokenizer = AutoTokenizer.from_pretrained("Scigi/sentiment-analysis-model")
|
tokenizer = AutoTokenizer.from_pretrained("Scigi/sentiment-analysis-model")
|
||||||
|
pipe = pipeline('text-classification', model="Scigi/sentiment-analysis-model", tokenizer = tokenizer)
|
||||||
|
|
||||||
def sentiment_prediction(data):
|
def sentiment_prediction(data):
|
||||||
pipe = pipeline('text-classification', model=model, tokenizer = tokenizer)
|
|
||||||
result = pipe(data)
|
result = pipe(data)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user