youngtsai commited on
Commit
361e0a3
·
1 Parent(s): 54be502

paragraph_save_output

Browse files
Files changed (1) hide show
  1. app.py +45 -26
app.py CHANGED
@@ -897,12 +897,17 @@ def update_exam_contents(selected_title):
897
  if exam["title"] == selected_title:
898
  return exam["title"], exam["question"], exam["hint"], exam["image_url"]
899
 
 
 
900
  def show_elements():
901
  return gr.update(visible=True)
902
 
903
  def hide_elements():
904
  return gr.update(visible=False)
905
 
 
 
 
906
  def generate_chinese_essay_idea(model, user_prompt, chinese_essay_title_input):
907
  sys_content = "你是一位老師,正在和我一起練習提高我的寫作技能。 給予的回覆不超過 500字。 用 Markdown 語法回答。"
908
  user_content = f"""
@@ -926,7 +931,6 @@ def generate_chinese_essay_idea(model, user_prompt, chinese_essay_title_input):
926
 
927
  return content
928
 
929
-
930
  # Download doc
931
  def create_word(content):
932
  unique_filename = str(uuid.uuid4())
@@ -1053,8 +1057,13 @@ english_logs_tab_button_js = """
1053
  return true;
1054
  }
1055
  """
 
 
 
 
 
1056
 
1057
- with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary_hue=gr.themes.colors.orange), css=CSS) as demo:
1058
 
1059
  with gr.Row(visible=False) as admin_group:
1060
  user_data = gr.Textbox(label="User Data", value="", elem_id="jutor_user_data_input")
@@ -1595,7 +1604,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1595
  generate_paragraph_button = gr.Button("請點擊此按鈕,合併已填寫的句子為草稿,供閱讀、下載及修訂", variant="primary")
1596
  with gr.Row():
1597
  with gr.Column():
1598
- paragraph_output = gr.Textbox(label="完整段落", show_copy_button=True)
1599
  with gr.Column():
1600
  paragraph_output_download = gr.File(label="下載段落草稿")
1601
 
@@ -1759,7 +1768,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1759
  """)
1760
  with gr.Row():
1761
  with gr.Column():
1762
- paragraph_correct_grammatical_spelling_errors_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的改正,你可以選擇是否修改:", show_copy_button=True)
1763
  with gr.Column():
1764
  generate_correct_grammatical_spelling_errors_button = gr.Button("✨ 修訂文法與拼字錯誤", variant="primary")
1765
  correct_grammatical_spelling_errors_output_table = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, visible=False)
@@ -1810,7 +1819,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1810
  """)
1811
  with gr.Row():
1812
  with gr.Column():
1813
- paragraph_refine_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
1814
  with gr.Column():
1815
  generate_refine_paragraph_button = gr.Button("✨ 段落改善建議", variant="primary")
1816
  refine_output_table = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, visible=False)
@@ -1892,17 +1901,23 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1892
  with gr.Column():
1893
  with gr.Row():
1894
  gr.Markdown("# Step 9. 寫作完成 Save and Share")
 
 
1895
  with gr.Row():
1896
  # 顯示最後段落寫作結果
1897
  with gr.Column():
1898
- paragraph_save_to_doc_button = gr.Button("點擊建立 doc", variant="primary")
1899
  with gr.Column():
1900
- paragraph_doc_download_link = gr.File(label="請點擊右下角連結(ex: 37KB),進行下載")
1901
 
1902
- paragraph_save_to_doc_button.click(
1903
  fn=download_content,
1904
  inputs=[paragraph_refine_input],
1905
- outputs=[paragraph_doc_download_link]
 
 
 
 
1906
  )
1907
 
1908
  with gr.Row():
@@ -1912,6 +1927,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1912
  with gr.Row(elem_id="paragraph_save_output"):
1913
  with gr.Accordion("歷程回顧", open=False) as history_accordion:
1914
  scenario_input_history = gr.Textbox(label="情境", visible=False)
 
1915
  gr.Markdown("<span style='color:#4e80ee'>主題</span>")
1916
  topic_input_history = gr.Markdown(label="主題")
1917
  gr.Markdown("<span style='color:#4e80ee'>要點/關鍵字</span>")
@@ -1922,13 +1938,16 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1922
  supporting_sentences_input_history = gr.Markdown(label="支持句")
1923
  gr.Markdown("<span style='color:#4e80ee'>結論句</span>")
1924
  conclusion_sentence_input_history = gr.Markdown(label="結論句")
 
1925
  gr.Markdown("<span style='color:#4e80ee'>完整段落</span>")
1926
  paragraph_output_history = gr.Markdown(label="完整段落")
 
1927
  paragraph_evaluate_output_history = gr.Dataframe(label="完整段落分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
1928
  correct_grammatical_spelling_errors_output_table_history = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, wrap=True, column_widths=[30, 30, 40])
1929
  refine_output_table_history = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, column_widths=[30, 30, 40])
1930
  gr.Markdown("<span style='color:#4e80ee'>修改建議</span>")
1931
  refine_output_history = gr.Markdown(label="修改建議")
 
1932
  gr.Markdown("<span style='color:#4e80ee'>修改結果</span>")
1933
  paragraph_save_output = gr.Markdown(label="最後結果")
1934
  with gr.Row():
@@ -1968,7 +1987,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1968
  ).then(
1969
  fn=paragraph_save_and_tts,
1970
  inputs=[
1971
- paragraph_refine_input
1972
  ],
1973
  outputs=[
1974
  paragraph_save_output,
@@ -1994,7 +2013,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1994
  gr.Markdown("## 輸入段落全文")
1995
  with gr.Row():
1996
  with gr.Column():
1997
- full_paragraph_input = gr.Textbox(label="輸入段落全文", lines=5)
1998
  with gr.Column():
1999
  with gr.Row():
2000
  full_paragraph_evaluate_button = gr.Button("✨ JUTOR 段落全文分析", variant="primary")
@@ -2006,7 +2025,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2006
  gr.Markdown("# JUTOR 修訂文法與拼字錯誤")
2007
  with gr.Row():
2008
  with gr.Column():
2009
- full_paragraph_correct_grammatical_spelling_errors_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:")
2010
  with gr.Column():
2011
  generate_full_paragraph_correct_grammatical_spelling_errors_button = gr.Button("✨ JUTOR 修訂文法與拼字錯誤", variant="primary")
2012
  full_paragraph_correct_grammatical_spelling_errors_output_table = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, column_widths=[30, 30, 40])
@@ -2019,7 +2038,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2019
  gr.Markdown("# JUTOR 段落改善建議")
2020
  with gr.Row():
2021
  with gr.Column():
2022
- full_paragraph_refine_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
2023
  with gr.Column():
2024
  generate_full_paragraph_refine_button = gr.Button("✨ JUTOR 段落改善建議", variant="primary")
2025
  full_paragraph_refine_output_table = gr.DataFrame(label="段落改善建議", wrap=True, interactive=False)
@@ -2033,7 +2052,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2033
  with gr.Row():
2034
  full_paragraph_save_button = gr.Button("輸出結果", variant="primary")
2035
  with gr.Row():
2036
- full_paragraph_save_output = gr.Textbox(label="最後結果")
2037
  full_audio_output = gr.Audio(label="音檔", type="filepath")
2038
 
2039
  # 建立歷程回顧
@@ -2180,7 +2199,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2180
  with gr.Row():
2181
  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)
2182
  past_exam_evaluation_user_prompt = gr.Textbox(label="Paragraph evaluate Prompt", value=default_user_generate_paragraph_evaluate_prompt, visible=False)
2183
- past_exam_evaluation_input = gr.Textbox("",lines= 10, label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:")
2184
  with gr.Column():
2185
  with gr.Row():
2186
  past_exam_evaluation_button = gr.Button("全文分析", variant="primary")
@@ -2190,7 +2209,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2190
  # 修正錯字、語法
2191
  with gr.Row():
2192
  with gr.Column():
2193
- past_exam_correct_grammatical_spelling_errors_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:",lines= 10, show_copy_button=True)
2194
  with gr.Column():
2195
  with gr.Row():
2196
  with gr.Accordion("prompt 提供微調測試", open=False, elem_classes=['accordion-prompts'], visible=False):
@@ -2209,7 +2228,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2209
  # 修正段落
2210
  with gr.Row():
2211
  with gr.Column():
2212
- past_exam_refine_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True,lines= 10)
2213
  with gr.Column():
2214
  with gr.Row():
2215
  with gr.Accordion("prompt 提供微調測試", open=False, elem_classes=['accordion-prompts'], visible=False):
@@ -2232,7 +2251,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2232
  past_exam_save_button = gr.Button("輸出結果", variant="primary")
2233
  with gr.Row():
2234
  with gr.Column():
2235
- past_exam_save_output = gr.Textbox(label="最後結果")
2236
  with gr.Column():
2237
  past_exam_audio_output = gr.Audio(label="音檔", type="filepath")
2238
 
@@ -2346,12 +2365,12 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2346
  with gr.Row():
2347
  gr.Markdown("# 📚 歷程回顧")
2348
  with gr.Row():
2349
- with gr.Accordion("英文段落練習歷程回顧", open=False) as english_grapragh_practice_logs_accordion:
2350
  with gr.Row():
2351
  with gr.Column(scale=1):
2352
  # 取得英文段落練習 log from GCS
2353
  paragraph_practice_logs_type = gr.State("jutor_write_paragraph_practice")
2354
- get_paragraph_practice_logs_button = gr.Button("取得英文段落練習歷程")
2355
  paragraph_practice_logs_session_list = gr.Radio(label="歷程時間列表")
2356
  with gr.Column(scale=3, variant="compact"):
2357
  gr.Markdown("<span style='color:#4e80ee'>主題</span>")
@@ -2398,12 +2417,12 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2398
  ]
2399
  )
2400
  with gr.Row():
2401
- with gr.Accordion("英文段落寫作評分歷程回顧", open=False) as english_grapragh_evaluate_logs_accordion:
2402
  with gr.Row():
2403
  with gr.Column(scale=1):
2404
  # 取得英文段落練習 log from GCS
2405
  full_paragraph_evaluate_logs_type = gr.State("jutor_write_full_paragraph_evaluation")
2406
- get_full_paragraph_evaluate_logs_button = gr.Button("取得英文段落寫作評分歷程")
2407
  full_paragraph_evaluate_logs_session_list = gr.Radio(label="歷程時間列表")
2408
  with gr.Column(scale=3, variant="compact"):
2409
  gr.Markdown("<span style='color:#4e80ee'>輸入段落全文</span>")
@@ -2447,12 +2466,12 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2447
  ]
2448
  )
2449
  with gr.Row():
2450
- with gr.Accordion("英文考古題寫作練習歷程回顧", open=False) as english_exam_practice_logs_accordion:
2451
  with gr.Row():
2452
  with gr.Column(scale=1):
2453
  # 取得英文段落練習 log from GCS
2454
  past_exam_logs_type = gr.State("jutor_write_past_exam")
2455
- get_past_exam_logs_button = gr.Button("取得英文考古題寫作練習歷程")
2456
  past_exam_logs_session_list = gr.Radio(label="歷程時間列表")
2457
  with gr.Column(scale=3, variant="compact"):
2458
  gr.Markdown("<span style='color:#4e80ee'>考古題</span>")
@@ -2639,7 +2658,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2639
  gr.Markdown("## 段落改善建議")
2640
  with gr.Row():
2641
  with gr.Column():
2642
- chinese_full_paragraph_refine_input = gr.Textbox(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
2643
  with gr.Column():
2644
  generate_chinese_full_paragraph_refine_button = gr.Button("段落改善建議", variant="primary")
2645
  chinese_full_paragraph_refine_output_table = gr.DataFrame(label="段落改善建議", wrap=True, interactive=False)
@@ -2653,7 +2672,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
2653
  with gr.Row():
2654
  chinese_full_paragraph_save_button = gr.Button("輸出結果", variant="primary")
2655
  with gr.Row():
2656
- chinese_full_paragraph_save_output = gr.Textbox(label="最後結果")
2657
  chinese_full_audio_output = gr.Audio(label="音檔", type="filepath")
2658
 
2659
  chinese_full_paragraph_evaluate_button.click(
 
897
  if exam["title"] == selected_title:
898
  return exam["title"], exam["question"], exam["hint"], exam["image_url"]
899
 
900
+
901
+ # 小工具
902
  def show_elements():
903
  return gr.update(visible=True)
904
 
905
  def hide_elements():
906
  return gr.update(visible=False)
907
 
908
+ def duplicate_element(element):
909
+ return element
910
+
911
  def generate_chinese_essay_idea(model, user_prompt, chinese_essay_title_input):
912
  sys_content = "你是一位老師,正在和我一起練習提高我的寫作技能。 給予的回覆不超過 500字。 用 Markdown 語法回答。"
913
  user_content = f"""
 
931
 
932
  return content
933
 
 
934
  # Download doc
935
  def create_word(content):
936
  unique_filename = str(uuid.uuid4())
 
1057
  return true;
1058
  }
1059
  """
1060
+ THEME = gr.themes.Glass(primary_hue=gr.themes.colors.blue, secondary_hue=gr.themes.colors.orange).set(
1061
+ button_primary_background_fill="*primary_300",
1062
+ button_shadow="*block_shadow",
1063
+ button_shadow_hover="*block_shadow"
1064
+ )
1065
 
1066
+ with gr.Blocks(theme=THEME, css=CSS) as demo:
1067
 
1068
  with gr.Row(visible=False) as admin_group:
1069
  user_data = gr.Textbox(label="User Data", value="", elem_id="jutor_user_data_input")
 
1604
  generate_paragraph_button = gr.Button("請點擊此按鈕,合併已填寫的句子為草稿,供閱讀、下載及修訂", variant="primary")
1605
  with gr.Row():
1606
  with gr.Column():
1607
+ paragraph_output = gr.TextArea(label="完整段落", show_copy_button=True)
1608
  with gr.Column():
1609
  paragraph_output_download = gr.File(label="下載段落草稿")
1610
 
 
1768
  """)
1769
  with gr.Row():
1770
  with gr.Column():
1771
+ paragraph_correct_grammatical_spelling_errors_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的改正,你可以選擇是否修改:", show_copy_button=True)
1772
  with gr.Column():
1773
  generate_correct_grammatical_spelling_errors_button = gr.Button("✨ 修訂文法與拼字錯誤", variant="primary")
1774
  correct_grammatical_spelling_errors_output_table = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, visible=False)
 
1819
  """)
1820
  with gr.Row():
1821
  with gr.Column():
1822
+ paragraph_refine_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
1823
  with gr.Column():
1824
  generate_refine_paragraph_button = gr.Button("✨ 段落改善建議", variant="primary")
1825
  refine_output_table = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, visible=False)
 
1901
  with gr.Column():
1902
  with gr.Row():
1903
  gr.Markdown("# Step 9. 寫作完成 Save and Share")
1904
+ with gr.Row():
1905
+ paragraph_practice_save_button = gr.Button("點擊建立 doc", variant="primary")
1906
  with gr.Row():
1907
  # 顯示最後段落寫作結果
1908
  with gr.Column():
1909
+ paragraph_practice_save_output = gr.TextArea(label="最後結果", show_copy_button=True)
1910
  with gr.Column():
1911
+ paragraph_practice_download_link = gr.File(label="請點擊右下角連結(ex: 37KB),進行下載")
1912
 
1913
+ paragraph_practice_save_button.click(
1914
  fn=download_content,
1915
  inputs=[paragraph_refine_input],
1916
+ outputs=[paragraph_practice_download_link]
1917
+ ).then(
1918
+ fn=duplicate_element,
1919
+ inputs=[paragraph_refine_input],
1920
+ outputs=[paragraph_practice_save_output]
1921
  )
1922
 
1923
  with gr.Row():
 
1927
  with gr.Row(elem_id="paragraph_save_output"):
1928
  with gr.Accordion("歷程回顧", open=False) as history_accordion:
1929
  scenario_input_history = gr.Textbox(label="情境", visible=False)
1930
+
1931
  gr.Markdown("<span style='color:#4e80ee'>主題</span>")
1932
  topic_input_history = gr.Markdown(label="主題")
1933
  gr.Markdown("<span style='color:#4e80ee'>要點/關鍵字</span>")
 
1938
  supporting_sentences_input_history = gr.Markdown(label="支持句")
1939
  gr.Markdown("<span style='color:#4e80ee'>結論句</span>")
1940
  conclusion_sentence_input_history = gr.Markdown(label="結論句")
1941
+
1942
  gr.Markdown("<span style='color:#4e80ee'>完整段落</span>")
1943
  paragraph_output_history = gr.Markdown(label="完整段落")
1944
+
1945
  paragraph_evaluate_output_history = gr.Dataframe(label="完整段落分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
1946
  correct_grammatical_spelling_errors_output_table_history = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, wrap=True, column_widths=[30, 30, 40])
1947
  refine_output_table_history = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, column_widths=[30, 30, 40])
1948
  gr.Markdown("<span style='color:#4e80ee'>修改建議</span>")
1949
  refine_output_history = gr.Markdown(label="修改建議")
1950
+
1951
  gr.Markdown("<span style='color:#4e80ee'>修改結果</span>")
1952
  paragraph_save_output = gr.Markdown(label="最後結果")
1953
  with gr.Row():
 
1987
  ).then(
1988
  fn=paragraph_save_and_tts,
1989
  inputs=[
1990
+ paragraph_practice_save_output
1991
  ],
1992
  outputs=[
1993
  paragraph_save_output,
 
2013
  gr.Markdown("## 輸入段落全文")
2014
  with gr.Row():
2015
  with gr.Column():
2016
+ full_paragraph_input = gr.TextArea(label="輸入段落全文")
2017
  with gr.Column():
2018
  with gr.Row():
2019
  full_paragraph_evaluate_button = gr.Button("✨ JUTOR 段落全文分析", variant="primary")
 
2025
  gr.Markdown("# JUTOR 修訂文法與拼字錯誤")
2026
  with gr.Row():
2027
  with gr.Column():
2028
+ full_paragraph_correct_grammatical_spelling_errors_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:")
2029
  with gr.Column():
2030
  generate_full_paragraph_correct_grammatical_spelling_errors_button = gr.Button("✨ JUTOR 修訂文法與拼字錯誤", variant="primary")
2031
  full_paragraph_correct_grammatical_spelling_errors_output_table = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, column_widths=[30, 30, 40])
 
2038
  gr.Markdown("# JUTOR 段落改善建議")
2039
  with gr.Row():
2040
  with gr.Column():
2041
+ full_paragraph_refine_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
2042
  with gr.Column():
2043
  generate_full_paragraph_refine_button = gr.Button("✨ JUTOR 段落改善建議", variant="primary")
2044
  full_paragraph_refine_output_table = gr.DataFrame(label="段落改善建議", wrap=True, interactive=False)
 
2052
  with gr.Row():
2053
  full_paragraph_save_button = gr.Button("輸出結果", variant="primary")
2054
  with gr.Row():
2055
+ full_paragraph_save_output = gr.TextArea(label="最後結果")
2056
  full_audio_output = gr.Audio(label="音檔", type="filepath")
2057
 
2058
  # 建立歷程回顧
 
2199
  with gr.Row():
2200
  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)
2201
  past_exam_evaluation_user_prompt = gr.Textbox(label="Paragraph evaluate Prompt", value=default_user_generate_paragraph_evaluate_prompt, visible=False)
2202
+ past_exam_evaluation_input = gr.TextArea("",label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:")
2203
  with gr.Column():
2204
  with gr.Row():
2205
  past_exam_evaluation_button = gr.Button("全文分析", variant="primary")
 
2209
  # 修正錯字、語法
2210
  with gr.Row():
2211
  with gr.Column():
2212
+ past_exam_correct_grammatical_spelling_errors_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:",lines= 10, show_copy_button=True)
2213
  with gr.Column():
2214
  with gr.Row():
2215
  with gr.Accordion("prompt 提供微調測試", open=False, elem_classes=['accordion-prompts'], visible=False):
 
2228
  # 修正段落
2229
  with gr.Row():
2230
  with gr.Column():
2231
+ past_exam_refine_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
2232
  with gr.Column():
2233
  with gr.Row():
2234
  with gr.Accordion("prompt 提供微調測試", open=False, elem_classes=['accordion-prompts'], visible=False):
 
2251
  past_exam_save_button = gr.Button("輸出結果", variant="primary")
2252
  with gr.Row():
2253
  with gr.Column():
2254
+ past_exam_save_output = gr.TextArea(label="最後結果")
2255
  with gr.Column():
2256
  past_exam_audio_output = gr.Audio(label="音檔", type="filepath")
2257
 
 
2365
  with gr.Row():
2366
  gr.Markdown("# 📚 歷程回顧")
2367
  with gr.Row():
2368
+ with gr.Accordion("📝 英文段落練習歷程回顧", open=False) as english_grapragh_practice_logs_accordion:
2369
  with gr.Row():
2370
  with gr.Column(scale=1):
2371
  # 取得英文段落練習 log from GCS
2372
  paragraph_practice_logs_type = gr.State("jutor_write_paragraph_practice")
2373
+ get_paragraph_practice_logs_button = gr.Button("👉 取得英文段落練習歷程", variant="primary")
2374
  paragraph_practice_logs_session_list = gr.Radio(label="歷程時間列表")
2375
  with gr.Column(scale=3, variant="compact"):
2376
  gr.Markdown("<span style='color:#4e80ee'>主題</span>")
 
2417
  ]
2418
  )
2419
  with gr.Row():
2420
+ with gr.Accordion("📊 英文段落寫作評分歷程回顧", open=False) as english_grapragh_evaluate_logs_accordion:
2421
  with gr.Row():
2422
  with gr.Column(scale=1):
2423
  # 取得英文段落練習 log from GCS
2424
  full_paragraph_evaluate_logs_type = gr.State("jutor_write_full_paragraph_evaluation")
2425
+ get_full_paragraph_evaluate_logs_button = gr.Button("👉 取得英文段落寫作評分歷程", variant="primary")
2426
  full_paragraph_evaluate_logs_session_list = gr.Radio(label="歷程時間列表")
2427
  with gr.Column(scale=3, variant="compact"):
2428
  gr.Markdown("<span style='color:#4e80ee'>輸入段落全文</span>")
 
2466
  ]
2467
  )
2468
  with gr.Row():
2469
+ with gr.Accordion("🎯 英文考古題寫作練習歷程回顧", open=False) as english_exam_practice_logs_accordion:
2470
  with gr.Row():
2471
  with gr.Column(scale=1):
2472
  # 取得英文段落練習 log from GCS
2473
  past_exam_logs_type = gr.State("jutor_write_past_exam")
2474
+ get_past_exam_logs_button = gr.Button("👉 取得英文考古題寫作練習歷程", variant="primary")
2475
  past_exam_logs_session_list = gr.Radio(label="歷程時間列表")
2476
  with gr.Column(scale=3, variant="compact"):
2477
  gr.Markdown("<span style='color:#4e80ee'>考古題</span>")
 
2658
  gr.Markdown("## 段落改善建議")
2659
  with gr.Row():
2660
  with gr.Column():
2661
+ chinese_full_paragraph_refine_input = gr.TextArea(label="這是你的原始寫作內容,參考 JUTOR 的建議,你可以選擇是否修改:", show_copy_button=True)
2662
  with gr.Column():
2663
  generate_chinese_full_paragraph_refine_button = gr.Button("段落改善建議", variant="primary")
2664
  chinese_full_paragraph_refine_output_table = gr.DataFrame(label="段落改善建議", wrap=True, interactive=False)
 
2672
  with gr.Row():
2673
  chinese_full_paragraph_save_button = gr.Button("輸出結果", variant="primary")
2674
  with gr.Row():
2675
+ chinese_full_paragraph_save_output = gr.TextArea(label="最後結果")
2676
  chinese_full_audio_output = gr.Audio(label="音檔", type="filepath")
2677
 
2678
  chinese_full_paragraph_evaluate_button.click(