Delete test
Browse files
test
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
|
| 3 |
-
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
| 4 |
-
|
| 5 |
-
model = T5ForConditionalGeneration.from_pretrained("Unbabel/gec-t5_small")
|
| 6 |
-
tokenizer = T5Tokenizer.from_pretrained('t5-small')
|
| 7 |
-
|
| 8 |
-
sentence = st.text_area("enter some text")
|
| 9 |
-
|
| 10 |
-
tokenized_sentence = tokenizer('gec: ' + sentence, max_length=128, truncation=True, padding='max_length', return_tensors='pt')
|
| 11 |
-
corrected_sentence = tokenizer.decode(
|
| 12 |
-
model.generate(
|
| 13 |
-
input_ids = tokenized_sentence.input_ids,
|
| 14 |
-
attention_mask = tokenized_sentence.attention_mask,
|
| 15 |
-
max_length=128,
|
| 16 |
-
num_beams=5,
|
| 17 |
-
early_stopping=True,
|
| 18 |
-
)[0],
|
| 19 |
-
skip_special_tokens=True,
|
| 20 |
-
clean_up_tokenization_spaces=True
|
| 21 |
-
)
|
| 22 |
-
print(corrected_sentence)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|