TedYeh
commited on
Commit
•
4ac7ae8
1
Parent(s):
939c3ef
update app
Browse files
app.py
CHANGED
@@ -5,8 +5,8 @@ model = T5ForConditionalGeneration.from_pretrained("CodeTed/traditional_CSC_t5")
|
|
5 |
|
6 |
|
7 |
def cged_correction(sentence = '為了降低少子化,政府可以堆動獎勵生育的政策。'):
|
8 |
-
input_ids = tokenizer('糾正句子裡的錯字:' + sentence
|
9 |
-
outputs = model.generate(input_ids, max_length=
|
10 |
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
11 |
return edited_text
|
12 |
|
|
|
5 |
|
6 |
|
7 |
def cged_correction(sentence = '為了降低少子化,政府可以堆動獎勵生育的政策。'):
|
8 |
+
input_ids = tokenizer('糾正句子裡的錯字:' + sentence, return_tensors="pt").input_ids
|
9 |
+
outputs = model.generate(input_ids, max_length=200)
|
10 |
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
11 |
return edited_text
|
12 |
|