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

中文 function

Browse files
Files changed (1) hide show
  1. app.py +45 -38
app.py CHANGED
@@ -1357,11 +1357,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1357
  with gr.Row():
1358
  chinese_full_paragraph_evaluate_output = gr.Dataframe(label="段落全文分析", wrap=True, column_widths=[20, 15, 65], interactive=False)
1359
 
1360
- chinese_full_paragraph_evaluate_button.click(
1361
- fn=generate_chinese_evaluation_table,
1362
- inputs=[chinese_full_paragraph_sys_content_input, user_generate_chinese_full_paragraph_evaluate_prompt, chinese_full_paragraph_input],
1363
- outputs=chinese_full_paragraph_evaluate_output
1364
- )
1365
 
1366
  # JUTOR 段落批改與整體建議
1367
  with gr.Row():
@@ -1378,20 +1374,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1378
  gr.Markdown("## 修訂結果")
1379
  revised_chinese_full_paragraph_diff = gr.HTML()
1380
 
1381
- generate_chinese_full_paragraph_correct_grammatical_spelling_errors_button.click(
1382
- fn=generate_correct_grammatical_spelling_errors,
1383
- inputs=[chinese_full_paragraph_sys_content_input, eng_level_input, chinese_full_paragraph_input, user_correct_grammatical_spelling_errors_prompt],
1384
- outputs=[chinese_full_paragraph_correct_grammatical_spelling_errors_output_table, revised_chinese_full_paragraph_output]
1385
- ).then(
1386
- fn=highlight_diff_texts,
1387
- inputs=[chinese_full_paragraph_correct_grammatical_spelling_errors_output_table, revised_chinese_full_paragraph_output],
1388
- outputs=revised_chinese_full_paragraph_diff
1389
- ).then(
1390
- fn=update_paragraph_correct_grammatical_spelling_errors_input,
1391
- inputs=[chinese_full_paragraph_input],
1392
- outputs=chinese_full_paragraph_correct_grammatical_spelling_errors_input
1393
- )
1394
-
1395
  # JUTOR 段落批改與整體建議
1396
  with gr.Row():
1397
  gr.Markdown("## 段落改善建議")
@@ -1405,19 +1388,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1405
  gr.Markdown("## 修改結果")
1406
  chinese_full_paragraph_refine_output_diff = gr.HTML()
1407
 
1408
- generate_chinese_full_paragraph_refine_button.click(
1409
- fn=generate_refine_paragraph,
1410
- inputs=[chinese_full_paragraph_sys_content_input, eng_level_input, chinese_full_paragraph_correct_grammatical_spelling_errors_input, user_refine_paragraph_prompt],
1411
- outputs=[chinese_full_paragraph_refine_output_table, chinese_full_paragraph_refine_output]
1412
- ).then(
1413
- fn=highlight_diff_texts,
1414
- inputs=[chinese_full_paragraph_refine_output_table, chinese_full_paragraph_refine_output],
1415
- outputs=chinese_full_paragraph_refine_output_diff
1416
- ).then(
1417
- fn=update_paragraph_refine_input,
1418
- inputs=[chinese_full_paragraph_correct_grammatical_spelling_errors_input],
1419
- outputs=chinese_full_paragraph_refine_input
1420
- )
1421
 
1422
  # 寫作完成
1423
  with gr.Row():
@@ -1427,11 +1398,47 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1427
  with gr.Row():
1428
  chinese_full_paragraph_save_output = gr.Textbox(label="最後結果")
1429
  chinese_full_audio_output = gr.Audio(label="音檔", type="filepath")
1430
-
1431
- chinese_full_paragraph_save_button.click(
1432
- fn=paragraph_save_and_tts,
1433
- inputs=[chinese_full_paragraph_refine_input],
1434
- outputs=[chinese_full_paragraph_save_output, chinese_full_audio_output]
1435
- )
1436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1437
  demo.launch()
 
1357
  with gr.Row():
1358
  chinese_full_paragraph_evaluate_output = gr.Dataframe(label="段落全文分析", wrap=True, column_widths=[20, 15, 65], interactive=False)
1359
 
1360
+
 
 
 
 
1361
 
1362
  # JUTOR 段落批改與整體建議
1363
  with gr.Row():
 
1374
  gr.Markdown("## 修訂結果")
1375
  revised_chinese_full_paragraph_diff = gr.HTML()
1376
 
1377
+
 
 
 
 
 
 
 
 
 
 
 
 
 
1378
  # JUTOR 段落批改與整體建議
1379
  with gr.Row():
1380
  gr.Markdown("## 段落改善建議")
 
1388
  gr.Markdown("## 修改結果")
1389
  chinese_full_paragraph_refine_output_diff = gr.HTML()
1390
 
1391
+
 
 
 
 
 
 
 
 
 
 
 
 
1392
 
1393
  # 寫作完成
1394
  with gr.Row():
 
1398
  with gr.Row():
1399
  chinese_full_paragraph_save_output = gr.Textbox(label="最後結果")
1400
  chinese_full_audio_output = gr.Audio(label="音檔", type="filepath")
 
 
 
 
 
 
1401
 
1402
+ chinese_full_paragraph_evaluate_button.click(
1403
+ fn=generate_chinese_evaluation_table,
1404
+ inputs=[chinese_full_paragraph_sys_content_input, user_generate_chinese_full_paragraph_evaluate_prompt, chinese_full_paragraph_input],
1405
+ outputs=chinese_full_paragraph_evaluate_output
1406
+ ).then(
1407
+ fn=update_paragraph_correct_grammatical_spelling_errors_input,
1408
+ inputs=[chinese_full_paragraph_input],
1409
+ outputs=chinese_full_paragraph_correct_grammatical_spelling_errors_input
1410
+ )
1411
+
1412
+ generate_chinese_full_paragraph_correct_grammatical_spelling_errors_button.click(
1413
+ fn=generate_correct_grammatical_spelling_errors,
1414
+ inputs=[chinese_full_paragraph_sys_content_input, eng_level_input, chinese_full_paragraph_correct_grammatical_spelling_errors_input, user_correct_grammatical_spelling_errors_prompt],
1415
+ outputs=[chinese_full_paragraph_correct_grammatical_spelling_errors_output_table, revised_chinese_full_paragraph_output]
1416
+ ).then(
1417
+ fn=highlight_diff_texts,
1418
+ inputs=[chinese_full_paragraph_correct_grammatical_spelling_errors_output_table, revised_chinese_full_paragraph_output],
1419
+ outputs=revised_chinese_full_paragraph_diff
1420
+ ).then(
1421
+ fn=update_paragraph_refine_input,
1422
+ inputs=[chinese_full_paragraph_correct_grammatical_spelling_errors_input],
1423
+ outputs=chinese_full_paragraph_refine_input
1424
+ )
1425
+
1426
+ generate_chinese_full_paragraph_refine_button.click(
1427
+ fn=generate_refine_paragraph,
1428
+ inputs=[chinese_full_paragraph_sys_content_input, eng_level_input, chinese_full_paragraph_refine_input, user_refine_paragraph_prompt],
1429
+ outputs=[chinese_full_paragraph_refine_output_table, chinese_full_paragraph_refine_output]
1430
+ ).then(
1431
+ fn=highlight_diff_texts,
1432
+ inputs=[chinese_full_paragraph_refine_output_table, chinese_full_paragraph_refine_output],
1433
+ outputs=chinese_full_paragraph_refine_output_diff
1434
+ )
1435
+
1436
+ chinese_full_paragraph_save_button.click(
1437
+ fn=paragraph_save_and_tts,
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()