exact_data2023/application/functions/errors.py

13 lines
509 B
Python
Raw Normal View History

2023-05-28 14:50:23 +02:00
from transformers import AutoTokenizer
from transformers import pipeline
2023-05-31 16:50:59 +02:00
#from transformers import BartForConditionalGeneration
2023-05-28 14:50:23 +02:00
2023-05-31 16:50:59 +02:00
tokenizer = AutoTokenizer.from_pretrained("szymonj/polish-simple-error-correction")
#model = BartForConditionalGeneration.from_pretrained("szymonj/polish-simple-error-correction")
pipe = pipeline("text2text-generation",model="szymonj/polish-simple-error-correction",tokenizer=tokenizer,max_length=2000)
2023-05-28 14:50:23 +02:00
def errors_correction(data):
result = pipe(data)
return result