Spaces:
Running
Running
fix past_exam_logs_session_list.select(
Browse files
app.py
CHANGED
@@ -3268,8 +3268,6 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3268 |
generate_full_paragraph_correct_grammatical_spelling_errors_button = gr.Button("✨ JUTOR 修訂文法與拼字錯誤", variant="primary", visible=False)
|
3269 |
full_paragraph_correct_grammatical_spelling_errors_output_table = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, column_widths=[30, 30, 40])
|
3270 |
revised_full_paragraph_output = gr.Textbox(label="Revised Paragraph", show_copy_button=True, visible=False)
|
3271 |
-
gr.Markdown("## 修訂建議")
|
3272 |
-
revised_full_paragraph_diff = gr.HTML()
|
3273 |
with gr.TabItem("JUTOR 段落改善建議"):
|
3274 |
# JUTOR 段落批改與整體建議
|
3275 |
with gr.Row():
|
@@ -3353,10 +3351,6 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3353 |
full_paragraph_correct_grammatical_spelling_errors_output_table,
|
3354 |
revised_full_paragraph_output
|
3355 |
]
|
3356 |
-
).then(
|
3357 |
-
fn=highlight_diff_texts,
|
3358 |
-
inputs=[full_paragraph_correct_grammatical_spelling_errors_output_table, revised_full_paragraph_output],
|
3359 |
-
outputs=revised_full_paragraph_diff
|
3360 |
).then(
|
3361 |
# 段落改善建議
|
3362 |
fn=generate_refine_paragraph,
|
@@ -3407,10 +3401,6 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3407 |
full_paragraph_correct_grammatical_spelling_errors_input,
|
3408 |
],
|
3409 |
outputs=[full_paragraph_correct_grammatical_spelling_errors_output_table, revised_full_paragraph_output]
|
3410 |
-
).then(
|
3411 |
-
fn=highlight_diff_texts,
|
3412 |
-
inputs=[full_paragraph_correct_grammatical_spelling_errors_output_table, revised_full_paragraph_output],
|
3413 |
-
outputs=revised_full_paragraph_diff
|
3414 |
).then(
|
3415 |
fn=update_paragraph_refine_input,
|
3416 |
inputs=[full_paragraph_correct_grammatical_spelling_errors_input],
|
@@ -3502,17 +3492,13 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3502 |
with gr.Column():
|
3503 |
past_exam_image = gr.Image(show_label=False)
|
3504 |
# 評分
|
|
|
3505 |
with gr.Row():
|
3506 |
-
|
3507 |
-
|
3508 |
-
|
3509 |
-
|
3510 |
-
|
3511 |
-
with gr.Row():
|
3512 |
-
past_exam_evaluation_button = gr.Button("全文分析", variant="primary")
|
3513 |
-
with gr.Row():
|
3514 |
-
past_exam_evaluation_output = gr.Dataframe(label="全文分析結果", wrap=True, column_widths=[20, 15, 65], interactive=False)
|
3515 |
-
|
3516 |
past_exam_dropdown.select(
|
3517 |
fn=update_exam_contents,
|
3518 |
inputs=[past_exam_dropdown],
|
@@ -3531,54 +3517,43 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3531 |
outputs=past_exam_evaluation_sys_content_prompt
|
3532 |
)
|
3533 |
|
3534 |
-
|
3535 |
-
|
3536 |
-
with gr.Column():
|
3537 |
-
past_exam_correct_grammatical_spelling_errors_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:",lines= 10, show_copy_button=True)
|
3538 |
-
with gr.Column():
|
3539 |
with gr.Row():
|
3540 |
-
|
3541 |
with gr.Row():
|
3542 |
-
|
|
|
|
|
|
|
3543 |
with gr.Row():
|
3544 |
-
|
3545 |
with gr.Row():
|
3546 |
-
gr.
|
|
|
|
|
3547 |
with gr.Row():
|
3548 |
-
|
3549 |
|
3550 |
-
|
3551 |
-
|
3552 |
-
with gr.Column():
|
3553 |
-
past_exam_refine_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
|
3554 |
-
with gr.Column():
|
3555 |
with gr.Row():
|
3556 |
-
|
3557 |
with gr.Row():
|
3558 |
-
|
3559 |
with gr.Row():
|
3560 |
-
|
3561 |
with gr.Row():
|
3562 |
-
gr.Markdown("##
|
3563 |
with gr.Row():
|
3564 |
-
|
|
|
3565 |
|
3566 |
# 最後成果
|
3567 |
with gr.Row():
|
3568 |
-
gr.Markdown("#
|
3569 |
with gr.Row():
|
3570 |
-
|
3571 |
-
with gr.Row():
|
3572 |
-
with gr.Column():
|
3573 |
-
past_exam_save_output = gr.TextArea(label="最後結果")
|
3574 |
-
with gr.Column():
|
3575 |
-
past_exam_audio_output = gr.Audio(label="音檔", type="filepath")
|
3576 |
-
|
3577 |
-
past_exam_save_button.click(
|
3578 |
-
fn=paragraph_save_and_tts,
|
3579 |
-
inputs=[past_exam_refine_input],
|
3580 |
-
outputs=[past_exam_save_output, past_exam_audio_output]
|
3581 |
-
)
|
3582 |
|
3583 |
# 建立歷程回顧
|
3584 |
with gr.Row():
|
@@ -3605,9 +3580,9 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3605 |
gr.Markdown("<span style='color:#4e80ee'>段落改善建議</span>")
|
3606 |
past_exam_refine_output_table_history = gr.Dataframe(wrap=True, interactive=False, column_widths=[30, 30, 40])
|
3607 |
|
3608 |
-
gr.Markdown("<span style='color:#4e80ee'
|
3609 |
past_exam_refine_output_history = gr.Markdown()
|
3610 |
-
gr.Markdown("<span style='color:#4e80ee'
|
3611 |
past_exam_save_output_history = gr.Markdown()
|
3612 |
|
3613 |
|
@@ -3644,6 +3619,59 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3644 |
outputs=past_exam_history_accordion
|
3645 |
)
|
3646 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3647 |
past_exam_evaluation_button.click(
|
3648 |
fn=generate_paragraph_evaluate,
|
3649 |
inputs=[
|
@@ -3668,11 +3696,10 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3668 |
eng_level_input,
|
3669 |
past_exam_correct_grammatical_spelling_errors_input,
|
3670 |
],
|
3671 |
-
outputs=[
|
3672 |
-
|
3673 |
-
|
3674 |
-
|
3675 |
-
outputs=past_exam_revised_diff
|
3676 |
).then(
|
3677 |
fn=update_paragraph_refine_input,
|
3678 |
inputs=[past_exam_correct_grammatical_spelling_errors_input],
|
@@ -3688,11 +3715,10 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3688 |
eng_level_input,
|
3689 |
past_exam_refine_input,
|
3690 |
],
|
3691 |
-
outputs=[
|
3692 |
-
|
3693 |
-
|
3694 |
-
|
3695 |
-
outputs=past_exam_refine_output_diff
|
3696 |
)
|
3697 |
|
3698 |
# ===== 英文歷程 ====
|
@@ -3724,10 +3750,10 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3724 |
paragraph_log_paragraph_evaluate_output_history = gr.Dataframe(label="完整段落分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
|
3725 |
paragraph_log_correct_grammatical_spelling_errors_output_table_history = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, wrap=True, column_widths=[30, 30, 40])
|
3726 |
paragraph_log_refine_output_table_history = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, column_widths=[30, 30, 40])
|
3727 |
-
gr.Markdown("<span style='color:#4e80ee'
|
3728 |
-
paragraph_log_refine_output_history = gr.Markdown(label="修改建議")
|
3729 |
-
gr.Markdown("<span style='color:#4e80ee'
|
3730 |
-
paragraph_log_paragraph_save_output = gr.Markdown(label="
|
3731 |
|
3732 |
get_paragraph_practice_logs_button.click(
|
3733 |
fn=get_logs_sessions,
|
@@ -3776,9 +3802,9 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3776 |
gr.Markdown("<span style='color:#4e80ee'>段落改善建議</span>")
|
3777 |
log_full_paragraph_refine_output_table_history = gr.Dataframe(wrap=True, interactive=False, column_widths=[30, 30, 40])
|
3778 |
|
3779 |
-
gr.Markdown("<span style='color:#4e80ee'
|
3780 |
log_full_paragraph_refine_output_history = gr.Markdown()
|
3781 |
-
gr.Markdown("<span style='color:#4e80ee'
|
3782 |
log_full_paragraph_save_output_history = gr.Markdown()
|
3783 |
|
3784 |
get_full_paragraph_evaluate_logs_button.click(
|
@@ -3827,7 +3853,9 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3827 |
gr.Markdown("<span style='color:#4e80ee'>段落改善建議</span>")
|
3828 |
past_exam_log_refine_output_table_history = gr.Dataframe(wrap=True, interactive=False, column_widths=[30, 30, 40])
|
3829 |
|
3830 |
-
gr.Markdown("<span style='color:#4e80ee'
|
|
|
|
|
3831 |
past_exam_log_save_output_history = gr.Markdown()
|
3832 |
|
3833 |
get_past_exam_logs_button.click(
|
@@ -3847,6 +3875,7 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
|
|
3847 |
past_exam_log_correct_grammatical_spelling_errors_output_table_history,
|
3848 |
past_exam_log_refine_input_history,
|
3849 |
past_exam_log_refine_output_table_history,
|
|
|
3850 |
past_exam_log_save_output_history
|
3851 |
]
|
3852 |
)
|
|
|
3268 |
generate_full_paragraph_correct_grammatical_spelling_errors_button = gr.Button("✨ JUTOR 修訂文法與拼字錯誤", variant="primary", visible=False)
|
3269 |
full_paragraph_correct_grammatical_spelling_errors_output_table = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, column_widths=[30, 30, 40])
|
3270 |
revised_full_paragraph_output = gr.Textbox(label="Revised Paragraph", show_copy_button=True, visible=False)
|
|
|
|
|
3271 |
with gr.TabItem("JUTOR 段落改善建議"):
|
3272 |
# JUTOR 段落批改與整體建議
|
3273 |
with gr.Row():
|
|
|
3351 |
full_paragraph_correct_grammatical_spelling_errors_output_table,
|
3352 |
revised_full_paragraph_output
|
3353 |
]
|
|
|
|
|
|
|
|
|
3354 |
).then(
|
3355 |
# 段落改善建議
|
3356 |
fn=generate_refine_paragraph,
|
|
|
3401 |
full_paragraph_correct_grammatical_spelling_errors_input,
|
3402 |
],
|
3403 |
outputs=[full_paragraph_correct_grammatical_spelling_errors_output_table, revised_full_paragraph_output]
|
|
|
|
|
|
|
|
|
3404 |
).then(
|
3405 |
fn=update_paragraph_refine_input,
|
3406 |
inputs=[full_paragraph_correct_grammatical_spelling_errors_input],
|
|
|
3492 |
with gr.Column():
|
3493 |
past_exam_image = gr.Image(show_label=False)
|
3494 |
# 評分
|
3495 |
+
|
3496 |
with gr.Row():
|
3497 |
+
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)
|
3498 |
+
past_exam_evaluation_input = gr.TextArea("",label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:")
|
3499 |
+
with gr.Row():
|
3500 |
+
past_exam_evaluation_analysis_button = gr.Button("✨ 全文分析", variant="primary", visible=True)
|
3501 |
+
|
|
|
|
|
|
|
|
|
|
|
3502 |
past_exam_dropdown.select(
|
3503 |
fn=update_exam_contents,
|
3504 |
inputs=[past_exam_dropdown],
|
|
|
3517 |
outputs=past_exam_evaluation_sys_content_prompt
|
3518 |
)
|
3519 |
|
3520 |
+
with gr.Tabs():
|
3521 |
+
with gr.TabItem("JUTOR 段落全文分析"):
|
|
|
|
|
|
|
3522 |
with gr.Row():
|
3523 |
+
past_exam_evaluation_button = gr.Button("✨ 全文分析", variant="primary", visible=False)
|
3524 |
with gr.Row():
|
3525 |
+
past_exam_evaluation_output = gr.Dataframe(label="全文分析結果", wrap=True, column_widths=[20, 15, 65], interactive=False)
|
3526 |
+
|
3527 |
+
with gr.TabItem("JUTOR 修正錯字、語法"):
|
3528 |
+
# 修正錯字、語法
|
3529 |
with gr.Row():
|
3530 |
+
past_exam_correct_grammatical_spelling_errors_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:",lines= 10, show_copy_button=True, visible=False)
|
3531 |
with gr.Row():
|
3532 |
+
past_exam_generate_correct_grammatical_spelling_errors_button = gr.Button("✨ 修訂文法與拼字錯誤", variant="primary", visible=False)
|
3533 |
+
with gr.Row():
|
3534 |
+
past_exam_correct_grammatical_spelling_errors_output_table = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, column_widths=[30, 30, 40])
|
3535 |
with gr.Row():
|
3536 |
+
past_exam_revised_output = gr.Textbox(label="Revised Paragraph", show_copy_button=True, visible=False)
|
3537 |
|
3538 |
+
with gr.TabItem("JUTOR 修正段落"):
|
3539 |
+
# 修正段落
|
|
|
|
|
|
|
3540 |
with gr.Row():
|
3541 |
+
past_exam_refine_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True, visible=False)
|
3542 |
with gr.Row():
|
3543 |
+
past_exam_generate_refine_button = gr.Button("✨ 段落改善建議", variant="primary", visible=False)
|
3544 |
with gr.Row():
|
3545 |
+
past_exam_refine_output_table = gr.DataFrame(label="Refine Paragraph 段落改善建議", wrap=True, interactive=False)
|
3546 |
with gr.Row():
|
3547 |
+
gr.Markdown("## AI 修改建議")
|
3548 |
with gr.Row():
|
3549 |
+
past_exam_refine_output = gr.HTML(label="修改建議", visible=True)
|
3550 |
+
past_exam_refine_audio_output = gr.Audio(label="音檔", type="filepath")
|
3551 |
|
3552 |
# 最後成果
|
3553 |
with gr.Row():
|
3554 |
+
gr.Markdown("# 自行根據建議修改")
|
3555 |
with gr.Row():
|
3556 |
+
past_exam_save_output = gr.TextArea(label="自行修改結果")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3557 |
|
3558 |
# 建立歷程回顧
|
3559 |
with gr.Row():
|
|
|
3580 |
gr.Markdown("<span style='color:#4e80ee'>段落改善建議</span>")
|
3581 |
past_exam_refine_output_table_history = gr.Dataframe(wrap=True, interactive=False, column_widths=[30, 30, 40])
|
3582 |
|
3583 |
+
gr.Markdown("<span style='color:#4e80ee'>AI 修改建議</span>")
|
3584 |
past_exam_refine_output_history = gr.Markdown()
|
3585 |
+
gr.Markdown("<span style='color:#4e80ee'>自行修改結果</span>")
|
3586 |
past_exam_save_output_history = gr.Markdown()
|
3587 |
|
3588 |
|
|
|
3619 |
outputs=past_exam_history_accordion
|
3620 |
)
|
3621 |
|
3622 |
+
# 總分析
|
3623 |
+
past_exam_evaluation_analysis_button.click(
|
3624 |
+
fn=duplicate_element,
|
3625 |
+
inputs=past_exam_evaluation_input,
|
3626 |
+
outputs=past_exam_correct_grammatical_spelling_errors_input,
|
3627 |
+
).then(
|
3628 |
+
fn=duplicate_element,
|
3629 |
+
inputs=past_exam_evaluation_input,
|
3630 |
+
outputs=past_exam_refine_input
|
3631 |
+
).then(
|
3632 |
+
fn=generate_paragraph_evaluate,
|
3633 |
+
inputs=[
|
3634 |
+
model,
|
3635 |
+
max_tokens,
|
3636 |
+
past_exam_evaluation_sys_content_prompt,
|
3637 |
+
past_exam_evaluation_input
|
3638 |
+
],
|
3639 |
+
outputs=past_exam_evaluation_output
|
3640 |
+
).then(
|
3641 |
+
fn=generate_correct_grammatical_spelling_errors,
|
3642 |
+
inputs=[
|
3643 |
+
model,
|
3644 |
+
max_tokens,
|
3645 |
+
past_exam_evaluation_sys_content_prompt,
|
3646 |
+
eng_level_input,
|
3647 |
+
past_exam_correct_grammatical_spelling_errors_input,
|
3648 |
+
],
|
3649 |
+
outputs=[
|
3650 |
+
past_exam_correct_grammatical_spelling_errors_output_table,
|
3651 |
+
past_exam_revised_output
|
3652 |
+
]
|
3653 |
+
).then(
|
3654 |
+
fn=generate_refine_paragraph,
|
3655 |
+
inputs=[
|
3656 |
+
model,
|
3657 |
+
max_tokens,
|
3658 |
+
past_exam_evaluation_sys_content_prompt,
|
3659 |
+
eng_level_input,
|
3660 |
+
past_exam_refine_input,
|
3661 |
+
],
|
3662 |
+
outputs=[
|
3663 |
+
past_exam_refine_output_table,
|
3664 |
+
past_exam_refine_output
|
3665 |
+
]
|
3666 |
+
).then(
|
3667 |
+
fn=paragraph_save_and_tts,
|
3668 |
+
inputs=[past_exam_refine_output],
|
3669 |
+
outputs=[
|
3670 |
+
past_exam_refine_output,
|
3671 |
+
past_exam_refine_audio_output
|
3672 |
+
]
|
3673 |
+
)
|
3674 |
+
|
3675 |
past_exam_evaluation_button.click(
|
3676 |
fn=generate_paragraph_evaluate,
|
3677 |
inputs=[
|
|
|
3696 |
eng_level_input,
|
3697 |
past_exam_correct_grammatical_spelling_errors_input,
|
3698 |
],
|
3699 |
+
outputs=[
|
3700 |
+
past_exam_correct_grammatical_spelling_errors_output_table,
|
3701 |
+
past_exam_revised_output
|
3702 |
+
]
|
|
|
3703 |
).then(
|
3704 |
fn=update_paragraph_refine_input,
|
3705 |
inputs=[past_exam_correct_grammatical_spelling_errors_input],
|
|
|
3715 |
eng_level_input,
|
3716 |
past_exam_refine_input,
|
3717 |
],
|
3718 |
+
outputs=[
|
3719 |
+
past_exam_refine_output_table,
|
3720 |
+
past_exam_refine_output
|
3721 |
+
]
|
|
|
3722 |
)
|
3723 |
|
3724 |
# ===== 英文歷程 ====
|
|
|
3750 |
paragraph_log_paragraph_evaluate_output_history = gr.Dataframe(label="完整段落分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
|
3751 |
paragraph_log_correct_grammatical_spelling_errors_output_table_history = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, wrap=True, column_widths=[30, 30, 40])
|
3752 |
paragraph_log_refine_output_table_history = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, column_widths=[30, 30, 40])
|
3753 |
+
gr.Markdown("<span style='color:#4e80ee'>AI 修改建議</span>")
|
3754 |
+
paragraph_log_refine_output_history = gr.Markdown(label="AI 修改建議")
|
3755 |
+
gr.Markdown("<span style='color:#4e80ee'>自行修改結果</span>")
|
3756 |
+
paragraph_log_paragraph_save_output = gr.Markdown(label="自行修改結果")
|
3757 |
|
3758 |
get_paragraph_practice_logs_button.click(
|
3759 |
fn=get_logs_sessions,
|
|
|
3802 |
gr.Markdown("<span style='color:#4e80ee'>段落改善建議</span>")
|
3803 |
log_full_paragraph_refine_output_table_history = gr.Dataframe(wrap=True, interactive=False, column_widths=[30, 30, 40])
|
3804 |
|
3805 |
+
gr.Markdown("<span style='color:#4e80ee'>AI 修改建議</span>")
|
3806 |
log_full_paragraph_refine_output_history = gr.Markdown()
|
3807 |
+
gr.Markdown("<span style='color:#4e80ee'>自行修改結果</span>")
|
3808 |
log_full_paragraph_save_output_history = gr.Markdown()
|
3809 |
|
3810 |
get_full_paragraph_evaluate_logs_button.click(
|
|
|
3853 |
gr.Markdown("<span style='color:#4e80ee'>段落改善建議</span>")
|
3854 |
past_exam_log_refine_output_table_history = gr.Dataframe(wrap=True, interactive=False, column_widths=[30, 30, 40])
|
3855 |
|
3856 |
+
gr.Markdown("<span style='color:#4e80ee'>AI 修改建議</span>")
|
3857 |
+
past_exam_log_refine_output_history = gr.Markdown()
|
3858 |
+
gr.Markdown("<span style='color:#4e80ee'>自行修改結果</span>")
|
3859 |
past_exam_log_save_output_history = gr.Markdown()
|
3860 |
|
3861 |
get_past_exam_logs_button.click(
|
|
|
3875 |
past_exam_log_correct_grammatical_spelling_errors_output_table_history,
|
3876 |
past_exam_log_refine_input_history,
|
3877 |
past_exam_log_refine_output_table_history,
|
3878 |
+
past_exam_log_refine_output_history,
|
3879 |
past_exam_log_save_output_history
|
3880 |
]
|
3881 |
)
|