TedYeh
commited on
Commit
•
100add5
1
Parent(s):
aee24dc
update app
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ model = T5ForConditionalGeneration.from_pretrained("CodeTed/traditional_CSC_t5")
|
|
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
|
@@ -14,7 +14,7 @@ with gr.Blocks() as demo:
|
|
14 |
gr.Markdown(
|
15 |
"""
|
16 |
# 中文錯別字校正 - Chinese Spelling Correction
|
17 |
-
### Find Spelling Error and
|
18 |
Start typing below to see the correction.
|
19 |
"""
|
20 |
)
|
|
|
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
|
|
|
14 |
gr.Markdown(
|
15 |
"""
|
16 |
# 中文錯別字校正 - Chinese Spelling Correction
|
17 |
+
### Find Spelling Error and get the correction!
|
18 |
Start typing below to see the correction.
|
19 |
"""
|
20 |
)
|