TedYeh
commited on
Commit
•
3970b0a
1
Parent(s):
03bdda8
update app
Browse files
app.py
CHANGED
@@ -6,11 +6,17 @@ model = T5ForConditionalGeneration.from_pretrained("CodeTed/traditional_CSC_t5")
|
|
6 |
|
7 |
def cged_correction(sentence = '為了降低少子化,政府可以堆動獎勵生育的政策。'):
|
8 |
input_ids = tokenizer('糾正句子裡的錯字:' + sentence + "_輸出句:", return_tensors="pt").input_ids
|
9 |
-
outputs = model.generate(input_ids, max_length=
|
10 |
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
11 |
return edited_text
|
12 |
|
13 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
#設定輸入元件
|
15 |
sent = gr.Textbox(label="Sentence")
|
16 |
# 設定輸出元件
|
|
|
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 |
|
13 |
with gr.Blocks() as demo:
|
14 |
+
gr.Markdown(
|
15 |
+
"""
|
16 |
+
# Flip Text!
|
17 |
+
Start typing below to see the output.
|
18 |
+
"""
|
19 |
+
)
|
20 |
#設定輸入元件
|
21 |
sent = gr.Textbox(label="Sentence")
|
22 |
# 設定輸出元件
|