Spaces:
Sleeping
Sleeping
修正錯誤語法
Browse files
app.py
CHANGED
@@ -1485,7 +1485,8 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
1485 |
outputs=[past_exam_title, past_exam_question, past_exam_hint, past_exam_image]
|
1486 |
)
|
1487 |
|
1488 |
-
|
|
|
1489 |
with gr.Column():
|
1490 |
with gr.Row():
|
1491 |
past_exam_evaluation_sys_content_prompt = gr.Textbox(label="System Prompt", value="You are an English teacher who is practicing with me to improve my English writing skill.", visible=False)
|
@@ -1497,11 +1498,71 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
1497 |
with gr.Row():
|
1498 |
past_exam_evaluation_output = gr.Dataframe(label="評分結果", wrap=True, column_widths=[20, 15, 65], interactive=False)
|
1499 |
|
1500 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1501 |
past_exam_evaluation_button.click(
|
1502 |
fn=generate_paragraph_evaluate,
|
1503 |
inputs=[past_exam_evaluation_sys_content_prompt, past_exam_evaluation_input, past_exam_evaluation_user_prompt],
|
1504 |
outputs=past_exam_evaluation_output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1505 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1506 |
|
1507 |
demo.launch()
|
|
|
1485 |
outputs=[past_exam_title, past_exam_question, past_exam_hint, past_exam_image]
|
1486 |
)
|
1487 |
|
1488 |
+
# 評分
|
1489 |
+
with gr.Row(visible=False):
|
1490 |
with gr.Column():
|
1491 |
with gr.Row():
|
1492 |
past_exam_evaluation_sys_content_prompt = gr.Textbox(label="System Prompt", value="You are an English teacher who is practicing with me to improve my English writing skill.", visible=False)
|
|
|
1498 |
with gr.Row():
|
1499 |
past_exam_evaluation_output = gr.Dataframe(label="評分結果", wrap=True, column_widths=[20, 15, 65], interactive=False)
|
1500 |
|
1501 |
+
# 修正錯誤語法
|
1502 |
+
with gr.Row():
|
1503 |
+
with gr.Column():
|
1504 |
+
past_exam_correct_grammatical_spelling_errors_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:")
|
1505 |
+
with gr.Column():
|
1506 |
+
with gr.Row():
|
1507 |
+
past_exam_generate_correct_grammatical_spelling_errors_button = gr.Button("JUTOR 修訂", variant="primary")
|
1508 |
+
with gr.Row():
|
1509 |
+
past_exam_correct_grammatical_spelling_errors_output_table = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, column_widths=[30, 30, 40])
|
1510 |
+
with gr.Row():
|
1511 |
+
past_exam_revised_output = gr.Textbox(label="Revised Paragraph", show_copy_button=True, visible=False)
|
1512 |
+
with gr.Row():
|
1513 |
+
gr.Markdown("## 修訂結果")
|
1514 |
+
with gr.Row():
|
1515 |
+
past_exam_revised_diff = gr.HTML()
|
1516 |
+
|
1517 |
+
# 修正段落
|
1518 |
+
with gr.Row():
|
1519 |
+
with gr.Column():
|
1520 |
+
past_exam_refine_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
|
1521 |
+
with gr.Column():
|
1522 |
+
with gr.Row():
|
1523 |
+
past_exam_generate_refine_button = gr.Button("段落改善建議", variant="primary")
|
1524 |
+
with gr.Row():
|
1525 |
+
past_exam_refine_output_table = gr.DataFrame(label="Refine Paragraph 段落改善建議", wrap=True, interactive=False)
|
1526 |
+
with gr.Row():
|
1527 |
+
past_exam_refine_output = gr.HTML(label="修改建議", visible=False)
|
1528 |
+
with gr.Row():
|
1529 |
+
gr.Markdown("## 修改結果")
|
1530 |
+
with gr.Row():
|
1531 |
+
past_exam_refine_output_diff = gr.HTML()
|
1532 |
+
|
1533 |
past_exam_evaluation_button.click(
|
1534 |
fn=generate_paragraph_evaluate,
|
1535 |
inputs=[past_exam_evaluation_sys_content_prompt, past_exam_evaluation_input, past_exam_evaluation_user_prompt],
|
1536 |
outputs=past_exam_evaluation_output
|
1537 |
+
).then(
|
1538 |
+
fn=update_paragraph_correct_grammatical_spelling_errors_input,
|
1539 |
+
inputs=[past_exam_evaluation_input],
|
1540 |
+
outputs=past_exam_correct_grammatical_spelling_errors_input
|
1541 |
+
)
|
1542 |
+
|
1543 |
+
past_exam_generate_correct_grammatical_spelling_errors_button.click(
|
1544 |
+
fn=generate_correct_grammatical_spelling_errors,
|
1545 |
+
inputs=[past_exam_evaluation_sys_content_prompt, eng_level_input, past_exam_correct_grammatical_spelling_errors_input, user_correct_grammatical_spelling_errors_prompt],
|
1546 |
+
outputs=[past_exam_correct_grammatical_spelling_errors_output_table, past_exam_revised_output]
|
1547 |
+
).then(
|
1548 |
+
fn=highlight_diff_texts,
|
1549 |
+
inputs=[past_exam_correct_grammatical_spelling_errors_output_table, past_exam_revised_output],
|
1550 |
+
outputs=past_exam_revised_diff
|
1551 |
+
).then(
|
1552 |
+
fn=update_paragraph_refine_input,
|
1553 |
+
inputs=[past_exam_correct_grammatical_spelling_errors_input],
|
1554 |
+
outputs=past_exam_refine_input
|
1555 |
)
|
1556 |
+
|
1557 |
+
past_exam_generate_refine_button.click(
|
1558 |
+
fn=generate_refine_paragraph,
|
1559 |
+
inputs=[past_exam_evaluation_sys_content_prompt, eng_level_input, past_exam_refine_input, user_refine_paragraph_prompt],
|
1560 |
+
outputs=[past_exam_refine_output_table, past_exam_refine_output]
|
1561 |
+
).then(
|
1562 |
+
fn=highlight_diff_texts,
|
1563 |
+
inputs=[past_exam_refine_output_table, past_exam_refine_output],
|
1564 |
+
outputs=past_exam_refine_output_diff
|
1565 |
+
)
|
1566 |
+
|
1567 |
|
1568 |
demo.launch()
|