youngtsai commited on
Commit
42f46a2
·
1 Parent(s): 9f6ee91

text update

Browse files
Files changed (1) hide show
  1. app.py +138 -125
app.py CHANGED
@@ -405,8 +405,8 @@ def generate_correct_grammatical_spelling_errors(model, sys_content, eng_level,
405
  ]
406
  headers = ["原文", "建議", "解釋"]
407
 
408
- corrections_list_gr_update = gr.update(value=corrections_list, headers=headers, wrap=True)
409
- reverse_paragraph_gr_update = gr.update(value=data["Revised Paragraph"])
410
 
411
  return corrections_list_gr_update, reverse_paragraph_gr_update
412
 
@@ -469,8 +469,8 @@ def generate_refine_paragraph(model, sys_content, eng_level, paragraph, user_ref
469
  for item in data['Suggestions and Explanations']
470
  ]
471
 
472
- refine_paragraph_gr_update = gr.update(value=table_data, headers=headers)
473
- revised_paragraph_gr_update = gr.update(value=data["Revised Paragraph"])
474
 
475
  return refine_paragraph_gr_update, revised_paragraph_gr_update
476
 
@@ -823,7 +823,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
823
  gr.Markdown("""舉例,情境是 `School & Learning`,段落主題是 `Time Management`,那麼 `Balancing school work and leisure time is a crucial aspect of effective time management` 就是合適的主題句,因為它清楚點出該段落將説明有效運用時間來讓課業及娛樂取得平衡。""")
824
  with gr.Row():
825
  with gr.Column():
826
- topic_sentence_input = gr.Textbox(label="寫出主題句")
827
  with gr.Column():
828
  generate_topic_sentences_button = gr.Button("✨ JUTOR 產出三個主題句,選出一個最合適的", variant="primary")
829
  topic_sentence_output_json = gr.JSON(label="AI 產出主題句", visible=False)
@@ -979,9 +979,9 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
979
  """)
980
  with gr.Row():
981
  with gr.Column():
982
- conclusion_sentence_input = gr.Textbox(label="寫出總結段落的結論句")
983
  with gr.Column():
984
- generate_conclusion_sentence_button = gr.Button("✨ JUTOR 產出結論句,供參考並自行寫出支持句", variant="primary")
985
  conclusion_sentence_output = gr.Radio(label="AI 產出結論句", visible=False, interactive=True)
986
 
987
  generate_conclusion_sentence_button.click(
@@ -1038,112 +1038,113 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1038
  - 最後,段落應該有一個結論句,總結主要觀點,強化所要傳遞的資訊。
1039
  """)
1040
  with gr.Row():
1041
- with gr.Column():
1042
- with gr.Row():
1043
- generate_paragraph_button = gr.Button("閱讀並修訂草稿", variant="primary")
1044
- with gr.Row():
1045
- paragraph_output = gr.Textbox(label="完整段落", show_copy_button=True)
1046
-
1047
- generate_paragraph_button.click(
1048
- fn=generate_paragraph,
1049
- inputs=[
1050
- topic_sentence_input,
1051
- supporting_sentences_input,
1052
- conclusion_sentence_input
1053
- ],
1054
- outputs=paragraph_output
1055
- )
1056
- with gr.Column():
1057
- with gr.Row(visible=False) as paragraph_evaluate_params:
1058
- default_user_generate_paragraph_evaluate_prompt = """
1059
- Based on the final paragraph provided, evaluate the writing in terms of content, organization, grammar, and vocabulary. Provide feedback in simple and supportive language.
1060
-
1061
- -- 根據上述的文章,以「內容(content)」層面評分。
1062
- Assess the student's writing by focusing on the 'Content' category according to the established rubric. Determine the clarity of the theme or thesis statement and whether it is supported by specific and complete details relevant to the topic. Use the following levels to guide your evaluation:
1063
-
1064
- - Excellent (5-4 points): Look for a clear and pertinent theme or thesis, directly related to the topic, with detailed support.
1065
- - Good (3 points): The theme should be present but may lack clarity or emphasis; some narrative development related to the theme should be evident.
1066
- - Fair (2-1 points): Identify if the theme is unclear or if the majority of the narrative is undeveloped or irrelevant to the theme.
1067
- - Poor (0 points): Determine if the response is off-topic or not written at all. Remember that any response that is off-topic or unwritten should receive zero points in all aspects.
1068
-
1069
- Your detailed feedback should explain the score you assign, including specific examples from the text to illustrate how well the student's content meets the criteria.
1070
- Translate your feedback into Traditional Chinese (zh-tw) as the final result (#中文解釋 zh-TW).
1071
-
1072
- 評分結果以 JSON 格式輸出: content: {
1073
- "level": "#Excellent(5-4 pts)/Good(3 pts)/Fair(2-1 pts)/Poor(0 pts)",
1074
- "explanation": "#中文解釋 zh-TW"
1075
- }
1076
-
1077
- -- 根據上述的文章,以「組織(organization)」層面評分。
1078
- Evaluate the student's writing with a focus on 'Organization' according to the grading rubric. Consider the structure of the text, including the presence of a clear introduction, development, and conclusion, as well as the coherence throughout the piece and the use of transitional phrases. Use the following levels to structure your feedback:
1079
-
1080
- - Excellent (5-4 points): Look for clear key points with a logical introduction, development, and conclusion, and note whether transitions are coherent and effectively used.
1081
- - Good (3 points): The key points should be identifiable but may not be well-arranged; observe any imbalance in development and transitional phrase usage.
1082
- - Fair (2-1 points): Identify if the key points are unclear and if the text lacks coherence.
1083
- - Poor (0 points): Check if the writing is completely unorganized or not written according to the prompts. Texts that are entirely unorganized should receive zero points.
1084
-
1085
- Your detailed feedback should explain the score you assign, including specific examples from the text to illustrate how well the student's Organization meets the criteria. Translate your feedback into Traditional Chinese (zh_tw) as the final result (#中文解釋).
1086
-
1087
- 評分結果以 JSON 格式輸出: organization: {
1088
- "level": "#Excellent(5-4 pts)/Good(3 pts)/Fair(2-1 pts)/Poor(0 pts)",
1089
- "explanation": "#中文解釋 zh-TW"
1090
- }
1091
-
1092
- -- 根據上述的文章,以「文法和用法(Grammar and usage)」層面評分。
1093
- Review the student's writing, paying special attention to 'Grammar/Sentence Structure'. Assess the accuracy of grammar and the variety of sentence structures throughout the essay. Use the rubric levels to judge the work as follows:
1094
-
1095
- - Excellent (5-4 points): Search for text with minimal grammatical errors and a diverse range of sentence structures.
1096
- - Good (3 points): There may be some grammatical errors, but they should not affect the overall meaning or flow of the text.
1097
- - Fair (2-1 points): Determine if grammatical errors are frequent and if they significantly affect the meaning of the text.
1098
- - Poor (0 points): If the essay contains severe grammatical errors throughout, leading to an unclear meaning, it should be marked accordingly.
1099
-
1100
- Your detailed feedback should explain the score you assign, including specific examples from the text to illustrate how well the student's Grammar/Sentence Structure meets the criteria. Translate your feedback into Traditional Chinese (zh_tw) as the final result (#中文解釋).
1101
-
1102
- 評分結果以 JSON 格式輸出: grammar_and_usage: {
1103
- "level": "#Excellent(5-4 pts)/Good(3 pts)/Fair(2-1 pts)/Poor(0 pts)",
1104
- "explanation": "#中文解釋 zh-TW"
1105
- }
1106
-
1107
- -- 根據上述的文章,以「詞彙(Vocabulary )」層面評分。
1108
- Assess the use of 'Vocabulary/Spelling' in the student's writing based on the criteria provided. Evaluate the precision and appropriateness of the vocabulary and the presence of spelling errors. Reference the following scoring levels in your analysis:
1109
-
1110
- - Excellent (5-4 points): The writing should contain accurate and appropriate vocabulary with almost no spelling mistakes.
1111
- - Good (3 points): Vocabulary might be somewhat repetitive or mundane; there may be occasional misused words and minor spelling mistakes, but they should not impede understanding.
1112
- - Fair (2-1 points): Notice if there are many vocabulary errors and spelling mistakes that clearly affect the clarity of the text's meaning.
1113
- - Poor (0 points): Writing that only contains scattered words related to the topic or is copied should be scored as such.
1114
-
1115
- Your detailed feedback should explain the score you assign, including specific examples from the text to illustrate how well the student's Vocabulary/Spelling meets the criteria. Translate your feedback into Traditional Chinese (zh_tw) as the final result (#中文解釋).
1116
-
1117
- 評分結果以 JSON 格式輸出: vocabulary: {
1118
- "level": "#Excellent(5-4 pts)/Good(3 pts)/Fair(2-1 pts)/Poor(0 pts)",
1119
- "explanation": "#中文解釋 zh-TW"
1120
- }
1121
-
1122
- -- 根據上述的文章,以「連貫性和連接詞(Coherence and Cohesion)」層面評分。
1123
- - 評分等級有三級:beginner, intermediate, advanced.
1124
- - 以繁體中文 zh-TW 解釋
1125
- 評分結果以 JSON 格式輸出: coherence_and_cohesion: {
1126
- "level": "#beginner/intermediate/advanced",
1127
- "explanation": "#中文解釋 zh-TW"
1128
- }
1129
-
1130
- Restrictions:
1131
- - the _explanation should be in Traditional Chinese (zh-TW), it's very important.
1132
-
1133
- Final Output JSON Format:
1134
- {{
1135
- “content“: {{content’s dict}},
1136
- organization“: {{organization'dict}},
1137
- grammar_and_usage“: {{grammar_and_usage'dict}},
1138
- vocabulary“: {{vocabulary'dict}},
1139
- coherence_and_cohesion“: {{coherence_and_cohesion'dict}}
1140
- }}
1141
- """
1142
- user_generate_paragraph_evaluate_prompt = gr.Textbox(label="Paragraph evaluate Prompt", value=default_user_generate_paragraph_evaluate_prompt, visible=False)
1143
- with gr.Row():
1144
- generate_paragraph_evaluate_button = gr.Button("✨ 段落分析", variant="primary")
1145
- with gr.Row():
1146
- paragraph_evaluate_output = gr.Dataframe(label="完整段落分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
 
1147
 
1148
  # 修訂文法與拼字錯誤
1149
  with gr.Row():
@@ -1200,7 +1201,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1200
  paragraph_correct_grammatical_spelling_errors_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的改正,你可以選擇是否修改:", show_copy_button=True)
1201
  with gr.Column():
1202
  generate_correct_grammatical_spelling_errors_button = gr.Button("✨ 修訂文法與拼字錯誤", variant="primary")
1203
- correct_grammatical_spelling_errors_output_table = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False)
1204
  revised_paragraph_output = gr.Textbox(label="Revised Paragraph", show_copy_button=True, visible=False)
1205
  gr.Markdown("## 修改參考")
1206
  revised_paragraph_diff = gr.HTML()
@@ -1251,13 +1252,17 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1251
  paragraph_refine_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
1252
  with gr.Column():
1253
  generate_refine_paragraph_button = gr.Button("✨ 段落改善建議", variant="primary")
1254
- refine_output_table = gr.DataFrame(label="段落改善建議", wrap=True, interactive=False)
1255
  refine_output = gr.HTML(label="修改建議", visible=False)
1256
  gr.Markdown("## 修改參考")
1257
  refine_output_diff = gr.HTML()
1258
 
1259
  # 段落分析
1260
  generate_paragraph_evaluate_button.click(
 
 
 
 
1261
  fn=generate_paragraph_evaluate,
1262
  inputs=[
1263
  model,
@@ -1274,6 +1279,10 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1274
 
1275
  # 修訂文法與拼字錯誤
1276
  generate_correct_grammatical_spelling_errors_button.click(
 
 
 
 
1277
  fn=generate_correct_grammatical_spelling_errors,
1278
  inputs=[
1279
  model,
@@ -1298,6 +1307,10 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1298
 
1299
  # 段落改善建議
1300
  generate_refine_paragraph_button.click(
 
 
 
 
1301
  fn=generate_refine_paragraph,
1302
  inputs=[
1303
  model,
@@ -1317,25 +1330,25 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1317
  with gr.Row():
1318
  with gr.Column():
1319
  with gr.Row():
1320
- gr.Markdown("## Final Step. 寫作完成 Save and Share")
1321
  with gr.Row():
1322
- gr.Markdown("### 完成修訂!你按部就班地完成了一次段落寫作練習,太棒了!")
1323
  with gr.Row():
1324
  paragraph_save_button = gr.Button("建立歷程回顧", variant="primary")
1325
  with gr.Row():
1326
  with gr.Accordion("歷程回顧", open=False) as history_accordion:
1327
  scenario_input_history = gr.Textbox(label="情境", visible=False)
1328
- topic_input_history = gr.Textbox(label="主題")
1329
- points_input_history = gr.Textbox(label="要點")
1330
- topic_sentence_input_history = gr.Textbox(label="主題句")
1331
- supporting_sentences_input_history = gr.Textbox(label="支持句", lines=3)
1332
- conclusion_sentence_input_history = gr.Textbox(label="結論句")
1333
- paragraph_output_history = gr.Textbox(label="完整段落", lines=4)
1334
  paragraph_evaluate_output_history = gr.Dataframe(label="完整段落分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
1335
  correct_grammatical_spelling_errors_output_table_history = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, wrap=True, column_widths=[30, 30, 40])
1336
  refine_output_table_history = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, column_widths=[30, 30, 40])
1337
- refine_output_history = gr.Textbox(label="修改建議", lines=4)
1338
- paragraph_save_output = gr.Textbox(label="最後結果", lines=4)
1339
  with gr.Row():
1340
  audio_output = gr.Audio(label="音檔", type="filepath")
1341
 
 
405
  ]
406
  headers = ["原文", "建議", "解釋"]
407
 
408
+ corrections_list_gr_update = gr.update(value=corrections_list, headers=headers, wrap=True, visible=True)
409
+ reverse_paragraph_gr_update = gr.update(value=data["Revised Paragraph"], visible=False)
410
 
411
  return corrections_list_gr_update, reverse_paragraph_gr_update
412
 
 
469
  for item in data['Suggestions and Explanations']
470
  ]
471
 
472
+ refine_paragraph_gr_update = gr.update(value=table_data, headers=headers, visible=True)
473
+ revised_paragraph_gr_update = gr.update(value=data["Revised Paragraph"],visible=False)
474
 
475
  return refine_paragraph_gr_update, revised_paragraph_gr_update
476
 
 
823
  gr.Markdown("""舉例,情境是 `School & Learning`,段落主題是 `Time Management`,那麼 `Balancing school work and leisure time is a crucial aspect of effective time management` 就是合適的主題句,因為它清楚點出該段落將説明有效運用時間來讓課業及娛樂取得平衡。""")
824
  with gr.Row():
825
  with gr.Column():
826
+ topic_sentence_input = gr.Textbox(label="根據主題、要點/關鍵字來寫主題句")
827
  with gr.Column():
828
  generate_topic_sentences_button = gr.Button("✨ JUTOR 產出三個主題句,選出一個最合適的", variant="primary")
829
  topic_sentence_output_json = gr.JSON(label="AI 產出主題句", visible=False)
 
979
  """)
980
  with gr.Row():
981
  with gr.Column():
982
+ conclusion_sentence_input = gr.Textbox(label="根據主題句、支持句來寫結論句")
983
  with gr.Column():
984
+ generate_conclusion_sentence_button = gr.Button("✨ JUTOR 產出結論句,供參考並自行寫出結論句", variant="primary")
985
  conclusion_sentence_output = gr.Radio(label="AI 產出結論句", visible=False, interactive=True)
986
 
987
  generate_conclusion_sentence_button.click(
 
1038
  - 最後,段落應該有一個結論句,總結主要觀點,強化所要傳遞的資訊。
1039
  """)
1040
  with gr.Row():
1041
+ generate_paragraph_button = gr.Button("閱讀並修訂草稿", variant="primary")
1042
+ with gr.Row():
1043
+ paragraph_output = gr.Textbox(label="完整段落", show_copy_button=True)
1044
+
1045
+ generate_paragraph_button.click(
1046
+ fn=show_elements,
1047
+ inputs=[],
1048
+ outputs=[paragraph_output]
1049
+ ).then(
1050
+ fn=generate_paragraph,
1051
+ inputs=[
1052
+ topic_sentence_input,
1053
+ supporting_sentences_input,
1054
+ conclusion_sentence_input
1055
+ ],
1056
+ outputs=paragraph_output
1057
+ )
1058
+ with gr.Row(visible=False) as paragraph_evaluate_params:
1059
+ default_user_generate_paragraph_evaluate_prompt = """
1060
+ Based on the final paragraph provided, evaluate the writing in terms of content, organization, grammar, and vocabulary. Provide feedback in simple and supportive language.
1061
+
1062
+ -- 根據上述的文章,以「內容(content)」層面評分。
1063
+ Assess the student's writing by focusing on the 'Content' category according to the established rubric. Determine the clarity of the theme or thesis statement and whether it is supported by specific and complete details relevant to the topic. Use the following levels to guide your evaluation:
1064
+
1065
+ - Excellent (5-4 points): Look for a clear and pertinent theme or thesis, directly related to the topic, with detailed support.
1066
+ - Good (3 points): The theme should be present but may lack clarity or emphasis; some narrative development related to the theme should be evident.
1067
+ - Fair (2-1 points): Identify if the theme is unclear or if the majority of the narrative is undeveloped or irrelevant to the theme.
1068
+ - Poor (0 points): Determine if the response is off-topic or not written at all. Remember that any response that is off-topic or unwritten should receive zero points in all aspects.
1069
+
1070
+ Your detailed feedback should explain the score you assign, including specific examples from the text to illustrate how well the student's content meets the criteria.
1071
+ Translate your feedback into Traditional Chinese (zh-tw) as the final result (#中文解釋 zh-TW).
1072
+
1073
+ 評分結果以 JSON 格式輸出: content: {
1074
+ "level": "#Excellent(5-4 pts)/Good(3 pts)/Fair(2-1 pts)/Poor(0 pts)",
1075
+ "explanation": "#中文解釋 zh-TW"
1076
+ }
1077
+
1078
+ -- 根據上述的文章,以「組織(organization)」層面評分。
1079
+ Evaluate the student's writing with a focus on 'Organization' according to the grading rubric. Consider the structure of the text, including the presence of a clear introduction, development, and conclusion, as well as the coherence throughout the piece and the use of transitional phrases. Use the following levels to structure your feedback:
1080
+
1081
+ - Excellent (5-4 points): Look for clear key points with a logical introduction, development, and conclusion, and note whether transitions are coherent and effectively used.
1082
+ - Good (3 points): The key points should be identifiable but may not be well-arranged; observe any imbalance in development and transitional phrase usage.
1083
+ - Fair (2-1 points): Identify if the key points are unclear and if the text lacks coherence.
1084
+ - Poor (0 points): Check if the writing is completely unorganized or not written according to the prompts. Texts that are entirely unorganized should receive zero points.
1085
+
1086
+ Your detailed feedback should explain the score you assign, including specific examples from the text to illustrate how well the student's Organization meets the criteria. Translate your feedback into Traditional Chinese (zh_tw) as the final result (#中文解釋).
1087
+
1088
+ 評分結果以 JSON 格式輸出: organization: {
1089
+ "level": "#Excellent(5-4 pts)/Good(3 pts)/Fair(2-1 pts)/Poor(0 pts)",
1090
+ "explanation": "#中文解釋 zh-TW"
1091
+ }
1092
+
1093
+ -- 根據上述的文章,以「文法和用法(Grammar and usage)」層面評分。
1094
+ Review the student's writing, paying special attention to 'Grammar/Sentence Structure'. Assess the accuracy of grammar and the variety of sentence structures throughout the essay. Use the rubric levels to judge the work as follows:
1095
+
1096
+ - Excellent (5-4 points): Search for text with minimal grammatical errors and a diverse range of sentence structures.
1097
+ - Good (3 points): There may be some grammatical errors, but they should not affect the overall meaning or flow of the text.
1098
+ - Fair (2-1 points): Determine if grammatical errors are frequent and if they significantly affect the meaning of the text.
1099
+ - Poor (0 points): If the essay contains severe grammatical errors throughout, leading to an unclear meaning, it should be marked accordingly.
1100
+
1101
+ Your detailed feedback should explain the score you assign, including specific examples from the text to illustrate how well the student's Grammar/Sentence Structure meets the criteria. Translate your feedback into Traditional Chinese (zh_tw) as the final result (#中文解釋).
1102
+
1103
+ 評分結果以 JSON 格式輸出: grammar_and_usage: {
1104
+ "level": "#Excellent(5-4 pts)/Good(3 pts)/Fair(2-1 pts)/Poor(0 pts)",
1105
+ "explanation": "#中文解釋 zh-TW"
1106
+ }
1107
+
1108
+ -- 根據上述的文章,以「詞彙(Vocabulary )」層面評分。
1109
+ Assess the use of 'Vocabulary/Spelling' in the student's writing based on the criteria provided. Evaluate the precision and appropriateness of the vocabulary and the presence of spelling errors. Reference the following scoring levels in your analysis:
1110
+
1111
+ - Excellent (5-4 points): The writing should contain accurate and appropriate vocabulary with almost no spelling mistakes.
1112
+ - Good (3 points): Vocabulary might be somewhat repetitive or mundane; there may be occasional misused words and minor spelling mistakes, but they should not impede understanding.
1113
+ - Fair (2-1 points): Notice if there are many vocabulary errors and spelling mistakes that clearly affect the clarity of the text's meaning.
1114
+ - Poor (0 points): Writing that only contains scattered words related to the topic or is copied should be scored as such.
1115
+
1116
+ Your detailed feedback should explain the score you assign, including specific examples from the text to illustrate how well the student's Vocabulary/Spelling meets the criteria. Translate your feedback into Traditional Chinese (zh_tw) as the final result (#中文解釋).
1117
+
1118
+ 評分結果以 JSON 格式輸出: vocabulary: {
1119
+ "level": "#Excellent(5-4 pts)/Good(3 pts)/Fair(2-1 pts)/Poor(0 pts)",
1120
+ "explanation": "#中文解釋 zh-TW"
1121
+ }
1122
+
1123
+ -- 根據上述的文章,以「連貫性和連接詞(Coherence and Cohesion)」層面評分。
1124
+ - 評分等級有三級:beginner, intermediate, advanced.
1125
+ - 以繁體中文 zh-TW 解釋
1126
+ 評分結果以 JSON 格式輸出: coherence_and_cohesion: {
1127
+ "level": "#beginner/intermediate/advanced",
1128
+ "explanation": "#中文解釋 zh-TW"
1129
+ }
1130
+
1131
+ Restrictions:
1132
+ - the _explanation should be in Traditional Chinese (zh-TW), it's very important.
1133
+
1134
+ Final Output JSON Format:
1135
+ {{
1136
+ content“: {{content’s dict}},
1137
+ organization“: {{organization'dict}},
1138
+ grammar_and_usage“: {{grammar_and_usage'dict}},
1139
+ vocabulary“: {{vocabulary'dict}},
1140
+ “coherence_and_cohesion“: {{coherence_and_cohesion'dict}}
1141
+ }}
1142
+ """
1143
+ user_generate_paragraph_evaluate_prompt = gr.Textbox(label="Paragraph evaluate Prompt", value=default_user_generate_paragraph_evaluate_prompt, visible=False)
1144
+ with gr.Row():
1145
+ generate_paragraph_evaluate_button = gr.Button("✨ 段落分析", variant="primary")
1146
+ with gr.Row():
1147
+ paragraph_evaluate_output = gr.Dataframe(label="完整段落分析", wrap=True, column_widths=[35, 15, 50], interactive=False, visible=False)
1148
 
1149
  # 修訂文法與拼字錯誤
1150
  with gr.Row():
 
1201
  paragraph_correct_grammatical_spelling_errors_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的改正,你可以選擇是否修改:", show_copy_button=True)
1202
  with gr.Column():
1203
  generate_correct_grammatical_spelling_errors_button = gr.Button("✨ 修訂文法與拼字錯誤", variant="primary")
1204
+ correct_grammatical_spelling_errors_output_table = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, visible=False)
1205
  revised_paragraph_output = gr.Textbox(label="Revised Paragraph", show_copy_button=True, visible=False)
1206
  gr.Markdown("## 修改參考")
1207
  revised_paragraph_diff = gr.HTML()
 
1252
  paragraph_refine_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
1253
  with gr.Column():
1254
  generate_refine_paragraph_button = gr.Button("✨ 段落改善建議", variant="primary")
1255
+ refine_output_table = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, visible=False)
1256
  refine_output = gr.HTML(label="修改建議", visible=False)
1257
  gr.Markdown("## 修改參考")
1258
  refine_output_diff = gr.HTML()
1259
 
1260
  # 段落分析
1261
  generate_paragraph_evaluate_button.click(
1262
+ fn=show_elements,
1263
+ inputs=[],
1264
+ outputs=[paragraph_evaluate_output]
1265
+ ).then(
1266
  fn=generate_paragraph_evaluate,
1267
  inputs=[
1268
  model,
 
1279
 
1280
  # 修訂文法與拼字錯誤
1281
  generate_correct_grammatical_spelling_errors_button.click(
1282
+ fn=show_elements,
1283
+ inputs=[],
1284
+ outputs=[correct_grammatical_spelling_errors_output_table]
1285
+ ).then(
1286
  fn=generate_correct_grammatical_spelling_errors,
1287
  inputs=[
1288
  model,
 
1307
 
1308
  # 段落改善建議
1309
  generate_refine_paragraph_button.click(
1310
+ fn=show_elements,
1311
+ inputs=[],
1312
+ outputs=[refine_output_table]
1313
+ ).then(
1314
  fn=generate_refine_paragraph,
1315
  inputs=[
1316
  model,
 
1330
  with gr.Row():
1331
  with gr.Column():
1332
  with gr.Row():
1333
+ gr.Markdown("# Step 9. 寫作完成 Save and Share")
1334
  with gr.Row():
1335
+ gr.Markdown("## 完成修訂!你按部就班地完成了一次段落寫作練習,太棒了!")
1336
  with gr.Row():
1337
  paragraph_save_button = gr.Button("建立歷程回顧", variant="primary")
1338
  with gr.Row():
1339
  with gr.Accordion("歷程回顧", open=False) as history_accordion:
1340
  scenario_input_history = gr.Textbox(label="情境", visible=False)
1341
+ topic_input_history = gr.Markdown(label="主題")
1342
+ points_input_history = gr.Markdown(label="要點/關鍵字")
1343
+ topic_sentence_input_history = gr.Markdown(label="主題句")
1344
+ supporting_sentences_input_history = gr.Markdown(label="支持句")
1345
+ conclusion_sentence_input_history = gr.Markdown(label="結論句")
1346
+ paragraph_output_history = gr.Markdown(label="完整段落")
1347
  paragraph_evaluate_output_history = gr.Dataframe(label="完整段落分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
1348
  correct_grammatical_spelling_errors_output_table_history = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, wrap=True, column_widths=[30, 30, 40])
1349
  refine_output_table_history = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, column_widths=[30, 30, 40])
1350
+ refine_output_history = gr.Markdown(label="修改建議")
1351
+ paragraph_save_output = gr.Markdown(label="最後結果")
1352
  with gr.Row():
1353
  audio_output = gr.Audio(label="音檔", type="filepath")
1354