youngtsai commited on
Commit
25ceb1a
·
1 Parent(s): 0281f07

- if totally no more suggestions, please provide at least 2 suggestions and explain that the paragraph is another possible way to improve.

Browse files
Files changed (1) hide show
  1. app.py +42 -42
app.py CHANGED
@@ -1067,7 +1067,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1067
 
1068
  Guidelines for Length and Complexity:
1069
  - Please keep explanations concise and straightforward
1070
- - if no more suggestions, please provide at least 2 suggestions and explain that the paragraph is another possible way to improve.
1071
 
1072
  Restrictions:
1073
  - avoiding overly technical language.
@@ -1210,12 +1210,6 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1210
  with gr.Row():
1211
  full_paragraph_evaluate_output = gr.Dataframe(label="段落全文分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
1212
 
1213
- full_paragraph_evaluate_button.click(
1214
- fn=generate_paragraph_evaluate,
1215
- inputs=[sys_content_input, full_paragraph_input, user_generate_full_paragraph_evaluate_prompt],
1216
- outputs=full_paragraph_evaluate_output
1217
- )
1218
-
1219
  # JUTOR 段落批改與整體建議
1220
  with gr.Row():
1221
  gr.Markdown("# JUTOR 段落批改與整體建議")
@@ -1231,20 +1225,6 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1231
  gr.Markdown("## 修訂結果")
1232
  revised_full_paragraph_diff = gr.HTML()
1233
 
1234
- generate_full_paragraph_correct_grammatical_spelling_errors_button.click(
1235
- fn=generate_correct_grammatical_spelling_errors,
1236
- inputs=[sys_content_input, eng_level_input, full_paragraph_input, user_correct_grammatical_spelling_errors_prompt],
1237
- outputs=[full_paragraph_correct_grammatical_spelling_errors_output_table, revised_full_paragraph_output]
1238
- ).then(
1239
- fn=highlight_diff_texts,
1240
- inputs=[full_paragraph_correct_grammatical_spelling_errors_output_table, revised_full_paragraph_output],
1241
- outputs=revised_full_paragraph_diff
1242
- ).then(
1243
- fn=update_paragraph_correct_grammatical_spelling_errors_input,
1244
- inputs=[full_paragraph_input],
1245
- outputs=full_paragraph_correct_grammatical_spelling_errors_input
1246
- )
1247
-
1248
  # JUTOR 段落批改與整體建議
1249
  with gr.Row():
1250
  gr.Markdown("# JUTOR 段落批改與整體建議")
@@ -1260,20 +1240,6 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1260
  gr.Markdown("## 修改結果")
1261
  full_paragraph_refine_output_diff = gr.HTML()
1262
 
1263
- generate_full_paragraph_refine_button.click(
1264
- fn=generate_refine_paragraph,
1265
- inputs=[sys_content_input, eng_level_input, full_paragraph_correct_grammatical_spelling_errors_input, user_refine_paragraph_prompt],
1266
- outputs=[full_paragraph_refine_output_table, full_paragraph_refine_output]
1267
- ).then(
1268
- fn=highlight_diff_texts,
1269
- inputs=[full_paragraph_refine_output_table, full_paragraph_refine_output],
1270
- outputs=full_paragraph_refine_output_diff
1271
- ).then(
1272
- fn=update_paragraph_refine_input,
1273
- inputs=[full_paragraph_correct_grammatical_spelling_errors_input],
1274
- outputs=full_paragraph_refine_input
1275
- )
1276
-
1277
  # 寫作完成
1278
  with gr.Row():
1279
  gr.Markdown("# 寫作完成")
@@ -1283,12 +1249,48 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1283
  full_paragraph_save_output = gr.Textbox(label="最後結果")
1284
  full_audio_output = gr.Audio(label="音檔", type="filepath")
1285
 
1286
- full_paragraph_save_button.click(
1287
- fn=paragraph_save_and_tts,
1288
- inputs=[full_paragraph_refine_input],
1289
- outputs=[full_paragraph_save_output, full_audio_output]
1290
- )
1291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1292
  with gr.Tab("中文全文批改"):
1293
  with gr.Row(visible=False) as chinese_full_paragraph_params:
1294
  chinese_full_paragraph_sys_content_input = gr.Textbox(label="System Prompt", value="You are an Chinese teacher who is practicing with me to improve my Chinese writing skill.")
@@ -1438,7 +1440,5 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1438
  inputs=[chinese_full_paragraph_refine_input],
1439
  outputs=[chinese_full_paragraph_save_output, chinese_full_audio_output]
1440
  )
1441
-
1442
-
1443
 
1444
  demo.launch()
 
1067
 
1068
  Guidelines for Length and Complexity:
1069
  - Please keep explanations concise and straightforward
1070
+ - if totally no more suggestions, please provide at least 2 suggestions and explain that the paragraph is another possible way to improve.
1071
 
1072
  Restrictions:
1073
  - avoiding overly technical language.
 
1210
  with gr.Row():
1211
  full_paragraph_evaluate_output = gr.Dataframe(label="段落全文分析", wrap=True, column_widths=[35, 15, 50], interactive=False)
1212
 
 
 
 
 
 
 
1213
  # JUTOR 段落批改與整體建議
1214
  with gr.Row():
1215
  gr.Markdown("# JUTOR 段落批改與整體建議")
 
1225
  gr.Markdown("## 修訂結果")
1226
  revised_full_paragraph_diff = gr.HTML()
1227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1228
  # JUTOR 段落批改與整體建議
1229
  with gr.Row():
1230
  gr.Markdown("# JUTOR 段落批改與整體建議")
 
1240
  gr.Markdown("## 修改結果")
1241
  full_paragraph_refine_output_diff = gr.HTML()
1242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1243
  # 寫作完成
1244
  with gr.Row():
1245
  gr.Markdown("# 寫作完成")
 
1249
  full_paragraph_save_output = gr.Textbox(label="最後結果")
1250
  full_audio_output = gr.Audio(label="音檔", type="filepath")
1251
 
 
 
 
 
 
1252
 
1253
+ full_paragraph_evaluate_button.click(
1254
+ fn=generate_paragraph_evaluate,
1255
+ inputs=[sys_content_input, full_paragraph_input, user_generate_full_paragraph_evaluate_prompt],
1256
+ outputs=full_paragraph_evaluate_output
1257
+ ).then(
1258
+ fn=update_paragraph_correct_grammatical_spelling_errors_input,
1259
+ inputs=[full_paragraph_input],
1260
+ outputs=full_paragraph_correct_grammatical_spelling_errors_input
1261
+ )
1262
+
1263
+ generate_full_paragraph_correct_grammatical_spelling_errors_button.click(
1264
+ fn=generate_correct_grammatical_spelling_errors,
1265
+ inputs=[sys_content_input, eng_level_input, full_paragraph_correct_grammatical_spelling_errors_input, user_correct_grammatical_spelling_errors_prompt],
1266
+ outputs=[full_paragraph_correct_grammatical_spelling_errors_output_table, revised_full_paragraph_output]
1267
+ ).then(
1268
+ fn=highlight_diff_texts,
1269
+ inputs=[full_paragraph_correct_grammatical_spelling_errors_output_table, revised_full_paragraph_output],
1270
+ outputs=revised_full_paragraph_diff
1271
+ ).then(
1272
+ fn=update_paragraph_refine_input,
1273
+ inputs=[full_paragraph_correct_grammatical_spelling_errors_input],
1274
+ outputs=full_paragraph_refine_input
1275
+ )
1276
+
1277
+ generate_full_paragraph_refine_button.click(
1278
+ fn=generate_refine_paragraph,
1279
+ inputs=[sys_content_input, eng_level_input, full_paragraph_refine_input, user_refine_paragraph_prompt],
1280
+ outputs=[full_paragraph_refine_output_table, full_paragraph_refine_output]
1281
+ ).then(
1282
+ fn=highlight_diff_texts,
1283
+ inputs=[full_paragraph_refine_output_table, full_paragraph_refine_output],
1284
+ outputs=full_paragraph_refine_output_diff
1285
+ )
1286
+
1287
+ full_paragraph_save_button.click(
1288
+ fn=paragraph_save_and_tts,
1289
+ inputs=[full_paragraph_refine_input],
1290
+ outputs=[full_paragraph_save_output, full_audio_output]
1291
+ )
1292
+
1293
+ # =====中文全文批改=====
1294
  with gr.Tab("中文全文批改"):
1295
  with gr.Row(visible=False) as chinese_full_paragraph_params:
1296
  chinese_full_paragraph_sys_content_input = gr.Textbox(label="System Prompt", value="You are an Chinese teacher who is practicing with me to improve my Chinese writing skill.")
 
1440
  inputs=[chinese_full_paragraph_refine_input],
1441
  outputs=[chinese_full_paragraph_save_output, chinese_full_audio_output]
1442
  )
 
 
1443
 
1444
  demo.launch()