youngtsai commited on
Commit
05d2f62
·
1 Parent(s): 95f431b

with gr.Accordion("歷程回顧", open=False) as history_accordion:

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -418,6 +418,10 @@ def paragraph_save_and_tts(paragraph_text):
418
  # Handle the error appropriately (e.g., return an error message or a default audio path)
419
  return paragraph_text, None
420
 
 
 
 
 
421
  with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary_hue=gr.themes.colors.orange)) as demo:
422
  with gr.Tab(label="段落寫作練習"):
423
  # basic inputs 主題與情境
@@ -1086,21 +1090,19 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1086
  with gr.Row():
1087
  paragraph_save_button = gr.Button("建立歷程回顧", variant="primary")
1088
  with gr.Row():
1089
- gr.Markdown("## 歷程回顧")
1090
- with gr.Row():
1091
- with gr.Accordion():
1092
  scenario_input_history = gr.Textbox(label="情境")
1093
  topic_input_history = gr.Textbox(label="主題")
1094
  points_input_history = gr.Textbox(label="要點")
1095
  topic_sentence_input_history = gr.Textbox(label="主題句")
1096
- supporting_sentences_input_history = gr.Textbox(label="支持句")
1097
  conclusion_sentence_input_history = gr.Textbox(label="結論句")
1098
- paragraph_output_history = gr.Textbox(label="完整段落")
1099
  paragraph_evaluate_output_history = gr.Dataframe(label="完整段落分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
1100
  correct_grammatical_spelling_errors_output_table_history = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, wrap=True, column_widths=[30, 30, 40])
1101
  refine_output_table_history = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, column_widths=[30, 30, 40])
1102
- refine_output_history = gr.Textbox(label="修改建議")
1103
- paragraph_save_output = gr.Textbox(label="最後結果")
1104
  with gr.Row():
1105
  audio_output = gr.Audio(label="音檔", type="filepath")
1106
 
@@ -1141,6 +1143,10 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1141
  paragraph_save_output,
1142
  audio_output
1143
  ]
 
 
 
 
1144
  )
1145
 
1146
  with gr.Tab("全文批改"):
 
418
  # Handle the error appropriately (e.g., return an error message or a default audio path)
419
  return paragraph_text, None
420
 
421
+ def update_history_accordion():
422
+ history_accordion_gr_update = gr.update(open=True)
423
+ return history_accordion_gr_update
424
+
425
  with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary_hue=gr.themes.colors.orange)) as demo:
426
  with gr.Tab(label="段落寫作練習"):
427
  # basic inputs 主題與情境
 
1090
  with gr.Row():
1091
  paragraph_save_button = gr.Button("建立歷程回顧", variant="primary")
1092
  with gr.Row():
1093
+ with gr.Accordion("歷程回顧", open=False) as history_accordion:
 
 
1094
  scenario_input_history = gr.Textbox(label="情境")
1095
  topic_input_history = gr.Textbox(label="主題")
1096
  points_input_history = gr.Textbox(label="要點")
1097
  topic_sentence_input_history = gr.Textbox(label="主題句")
1098
+ supporting_sentences_input_history = gr.Textbox(label="支持句", lines=3)
1099
  conclusion_sentence_input_history = gr.Textbox(label="結論句")
1100
+ paragraph_output_history = gr.Textbox(label="完整段落", lines=4)
1101
  paragraph_evaluate_output_history = gr.Dataframe(label="完整段落分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
1102
  correct_grammatical_spelling_errors_output_table_history = gr.Dataframe(label="修訂文法與拼字錯誤", interactive=False, wrap=True, column_widths=[30, 30, 40])
1103
  refine_output_table_history = gr.Dataframe(label="段落改善建議", wrap=True, interactive=False, column_widths=[30, 30, 40])
1104
+ refine_output_history = gr.Textbox(label="修改建議", lines=4)
1105
+ paragraph_save_output = gr.Textbox(label="最後結果", lines=4)
1106
  with gr.Row():
1107
  audio_output = gr.Audio(label="音檔", type="filepath")
1108
 
 
1143
  paragraph_save_output,
1144
  audio_output
1145
  ]
1146
+ ).then(
1147
+ fn=update_history_accordion,
1148
+ inputs=[],
1149
+ outputs=history_accordion
1150
  )
1151
 
1152
  with gr.Tab("全文批改"):