youngtsai commited on
Commit
9e96d9e
·
1 Parent(s): 25ceb1a
Files changed (1) hide show
  1. app.py +71 -0
app.py CHANGED
@@ -466,6 +466,7 @@ def generate_chinese_evaluation_table(sys_content, user_prompt, text):
466
 
467
 
468
  with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary_hue=gr.themes.colors.orange)) as demo:
 
469
  with gr.Tab(label="英文段落寫作練習"):
470
  # basic inputs 主題與情境
471
  with gr.Row():
@@ -1192,6 +1193,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1192
  outputs=history_accordion
1193
  )
1194
 
 
1195
  with gr.Tab("英文全文批改"):
1196
  with gr.Row(visible=False) as full_paragraph_params:
1197
  full_paragraph_sys_content_input = gr.Textbox(label="System Prompt", value="You are an English teacher who is practicing with me to improve my English writing skill.")
@@ -1441,4 +1443,73 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
1441
  outputs=[chinese_full_paragraph_save_output, chinese_full_audio_output]
1442
  )
1443
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1444
  demo.launch()
 
466
 
467
 
468
  with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary_hue=gr.themes.colors.orange)) as demo:
469
+ # ===== 英文段落寫作練習 =====
470
  with gr.Tab(label="英文段落寫作練習"):
471
  # basic inputs 主題與情境
472
  with gr.Row():
 
1193
  outputs=history_accordion
1194
  )
1195
 
1196
+ # ====="英文全文批改"=====
1197
  with gr.Tab("英文全文批改"):
1198
  with gr.Row(visible=False) as full_paragraph_params:
1199
  full_paragraph_sys_content_input = gr.Textbox(label="System Prompt", value="You are an English teacher who is practicing with me to improve my English writing skill.")
 
1443
  outputs=[chinese_full_paragraph_save_output, chinese_full_audio_output]
1444
  )
1445
 
1446
+ # ====="考古題寫作練習"=====
1447
+ with gr.Tab("考古題寫作練習"):
1448
+ with gr.Row():
1449
+ with gr.Column():
1450
+ with gr.Row():
1451
+ gr.Markdown("# 考古題寫作練習")
1452
+ with gr.Row():
1453
+ gr.Markdown("## 選擇考古題")
1454
+ with gr.Row():
1455
+ past_exam_choices = ["98學測","99學測","100學測"]
1456
+ past_exam_dropdown = gr.Dropdown(label="選擇考古題", choices=past_exam_choices, value="98學測")
1457
+ with gr.Row():
1458
+ gr.Markdown("## 98 學測")
1459
+ with gr.Row():
1460
+ with gr.Column():
1461
+ with gr.Row():
1462
+ gr.Markdown("""###
1463
+ - 說明︰依提示寫一篇英文作文,文長至少 120 個單詞(words)。
1464
+ - 提示︰ 請根據右方圖片的場景,描述整個事件發生的前因後果。文
1465
+ 章請分兩段,第一段說明之前發生了什麼事情,並根據圖片內容描
1466
+ 述現在的狀況;第二段請合理說明接下來可能會發生什麼事,或者
1467
+ 未來該做些什麼。
1468
+ """)
1469
+ with gr.Row():
1470
+ with gr.Accordion("下筆提示", open=False):
1471
+ gr.Textbox("如何下筆:先用常理推敲內容。根據段落提示書寫,必須加入更多細節例證才會生動寫實。", label="",lines=3)
1472
+ with gr.Row():
1473
+ gr.Markdown("## 第一段說明之前發生了什麼事情,並根據圖片內容描述現在的狀況")
1474
+ with gr.Row():
1475
+ with gr.Accordion("第一段提示", open=False):
1476
+ gr.Markdown("""
1477
+ - 之前發生了什麼事情
1478
+ - 房子在哪裡?住什麼人?他們的生活(對比災難發生後)。
1479
+ - 根據圖片內容描述現在的狀況
1480
+ - 想像什麼原因造成現在的結果:地震?土石流?
1481
+ - 描述災難發生造成現況,如果能用第一人稱描寫災難發生的細
1482
+ - 節及自己的感受會更吸引人。
1483
+ """)
1484
+ with gr.Row():
1485
+ gr.Markdown("## 第二段請合理說明接下來可能會發生什麼事,或者未來該做些什麼")
1486
+ with gr.Row():
1487
+ with gr.Accordion("第一段提示", open=False):
1488
+ gr.Markdown("""
1489
+ - 說明接下來可能會發生什麼事,或者未來該做些什麼
1490
+ - 災難後可能發生的事,例如重回家園看到破舊的景象、災難損壞、如果災難重建等等。
1491
+ """)
1492
+
1493
+ with gr.Column():
1494
+ gr.Image("https://storage.googleapis.com/jutor/98%E5%AD%B8%E6%B8%AC%E4%BD%9C%E6%96%87-%E5%9C%96.png")
1495
+
1496
+ with gr.Row():
1497
+ with gr.Column():
1498
+ with gr.Row():
1499
+ 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)
1500
+ past_exam_evaluation_user_prompt = gr.Textbox(label="Paragraph evaluate Prompt", value=default_user_generate_paragraph_evaluate_prompt, visible=False)
1501
+ past_exam_evaluation_input = gr.Textbox("",lines= 10)
1502
+ with gr.Column():
1503
+ with gr.Row():
1504
+ past_exam_evaluation_button = gr.Button("評分", variant="primary")
1505
+ with gr.Row():
1506
+ past_exam_evaluation_output = gr.Dataframe(label="評分結果", wrap=True, column_widths=[20, 15, 65], interactive=False)
1507
+
1508
+ # generate_paragraph_evaluate(sys_content, paragraph, user_generate_paragraph_evaluate_prompt)
1509
+ past_exam_evaluation_button.click(
1510
+ fn=generate_paragraph_evaluate,
1511
+ inputs=[past_exam_evaluation_sys_content_prompt, past_exam_evaluation_input, past_exam_evaluation_user_prompt],
1512
+ outputs=past_exam_evaluation_output
1513
+ )
1514
+
1515
  demo.launch()