Spaces:
Sleeping
Sleeping
with gr.Row(visible=True) as english_grapragh_practice_row:
Browse files
app.py
CHANGED
@@ -681,23 +681,42 @@ def init_params(request: gr.Request):
|
|
681 |
|
682 |
return english_group, chinese_group
|
683 |
|
684 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
685 |
if selected_tab == "📝 英文段落寫作練習":
|
|
|
|
|
|
|
686 |
gr_update_english_grapragh_practice_button = gr.update(variant="primary")
|
687 |
gr_update_english_grapragh_evaluate_button = gr.update(variant="secondary")
|
688 |
gr_update_english_exam_practice_tab_button = gr.update(variant="secondary")
|
|
|
689 |
elif selected_tab == "📊 英文段落寫作評分":
|
|
|
|
|
|
|
690 |
gr_update_english_grapragh_practice_button = gr.update(variant="secondary")
|
691 |
gr_update_english_grapragh_evaluate_button = gr.update(variant="primary")
|
692 |
gr_update_english_exam_practice_tab_button = gr.update(variant="secondary")
|
|
|
693 |
elif selected_tab == "🎯 英文考古題寫作練習":
|
|
|
|
|
|
|
694 |
gr_update_english_grapragh_practice_button = gr.update(variant="secondary")
|
695 |
gr_update_english_grapragh_evaluate_button = gr.update(variant="secondary")
|
696 |
gr_update_english_exam_practice_tab_button = gr.update(variant="primary")
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
gr_update_english_grapragh_practice_button, \
|
702 |
gr_update_english_grapragh_evaluate_button, \
|
703 |
gr_update_english_exam_practice_tab_button
|
@@ -730,10 +749,11 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
730 |
english_grapragh_evaluate_button = gr.Button("📊 英文段落寫作評分")
|
731 |
with gr.Column():
|
732 |
english_exam_practice_tab_button = gr.Button("🎯 英文考古題寫作練習")
|
733 |
-
|
734 |
-
with gr.Tabs(visible=True, selected="📝 英文段落寫作練習") as english_grapragh_practice_tab_tabs:
|
735 |
# ===== 英文段落寫作練習 =====
|
736 |
-
with gr.
|
|
|
|
|
737 |
with gr.Row():
|
738 |
with gr.Column():
|
739 |
gr.Image(value="https://storage.googleapis.com/jutor/Jutor%E6%AE%B5%E8%90%BD%20banner.jpg", show_label=False, show_download_button=False)
|
@@ -1564,16 +1584,18 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
1564 |
outputs=history_accordion
|
1565 |
)
|
1566 |
|
|
|
1567 |
# ====="英文全文批改"=====
|
1568 |
-
with gr.
|
1569 |
with gr.Row(visible=False) as full_paragraph_params:
|
1570 |
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.")
|
1571 |
default_user_generate_full_paragraph_evaluate_prompt = default_user_generate_paragraph_evaluate_prompt
|
1572 |
user_generate_full_paragraph_evaluate_prompt = gr.Textbox(label="Paragraph evaluate Prompt", value=default_user_generate_full_paragraph_evaluate_prompt, visible=False)
|
1573 |
-
|
|
|
1574 |
# 輸入段落全文
|
1575 |
with gr.Row():
|
1576 |
-
gr.Markdown("
|
1577 |
with gr.Row():
|
1578 |
with gr.Column():
|
1579 |
full_paragraph_input = gr.Textbox(label="輸入段落全文", lines=5)
|
@@ -1664,12 +1686,13 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
1664 |
outputs=[full_paragraph_save_output, full_audio_output]
|
1665 |
)
|
1666 |
|
|
|
1667 |
# ====="英文考古題寫作練習====="
|
1668 |
-
with gr.
|
1669 |
with gr.Row():
|
1670 |
with gr.Column():
|
1671 |
with gr.Row():
|
1672 |
-
gr.Markdown("#
|
1673 |
with gr.Row():
|
1674 |
gr.Markdown("## 選擇考古題")
|
1675 |
with gr.Row():
|
@@ -1780,39 +1803,37 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
1780 |
outputs=past_exam_refine_output_diff
|
1781 |
)
|
1782 |
|
1783 |
-
|
1784 |
-
# with gr.Row():
|
1785 |
-
# with gr.Column():
|
1786 |
-
# english_grapragh_practice_button = gr.Button("📝 英文段落寫作練習")
|
1787 |
-
# with gr.Column():
|
1788 |
-
# english_grapragh_evaluate_button = gr.Button("📊 英文段落寫作評分")
|
1789 |
-
# with gr.Column():
|
1790 |
-
# english_exam_practice_tab_button = gr.Button("🎯 英文考古題寫作練習")
|
1791 |
english_grapragh_practice_button.click(
|
1792 |
-
fn=
|
1793 |
inputs=[english_grapragh_practice_button],
|
1794 |
outputs=[
|
1795 |
-
|
|
|
|
|
1796 |
english_grapragh_practice_button,
|
1797 |
english_grapragh_evaluate_button,
|
1798 |
english_exam_practice_tab_button
|
1799 |
]
|
1800 |
)
|
1801 |
english_grapragh_evaluate_button.click(
|
1802 |
-
fn=
|
1803 |
inputs=[english_grapragh_evaluate_button],
|
1804 |
outputs=[
|
1805 |
-
|
|
|
|
|
1806 |
english_grapragh_practice_button,
|
1807 |
english_grapragh_evaluate_button,
|
1808 |
english_exam_practice_tab_button
|
1809 |
]
|
1810 |
)
|
1811 |
english_exam_practice_tab_button.click(
|
1812 |
-
fn=
|
1813 |
inputs=[english_exam_practice_tab_button],
|
1814 |
outputs=[
|
1815 |
-
|
|
|
|
|
1816 |
english_grapragh_practice_button,
|
1817 |
english_grapragh_evaluate_button,
|
1818 |
english_exam_practice_tab_button
|
|
|
681 |
|
682 |
return english_group, chinese_group
|
683 |
|
684 |
+
def update_english_grapragh_practice_rows(selected_tab):
|
685 |
+
# outputs=[
|
686 |
+
# english_grapragh_practice_row,
|
687 |
+
# english_grapragh_evaluate_row,
|
688 |
+
# english_exam_practice_row,
|
689 |
+
# english_grapragh_practice_button,
|
690 |
+
# english_grapragh_evaluate_button,
|
691 |
+
# english_exam_practice_tab_button
|
692 |
+
# ]
|
693 |
if selected_tab == "📝 英文段落寫作練習":
|
694 |
+
gr_update_english_grapragh_practice_row = gr.update(visible=True)
|
695 |
+
gr_update_english_grapragh_evaluate_row = gr.update(visible=False)
|
696 |
+
gr_update_english_exam_practice_row = gr.update(visible=False)
|
697 |
gr_update_english_grapragh_practice_button = gr.update(variant="primary")
|
698 |
gr_update_english_grapragh_evaluate_button = gr.update(variant="secondary")
|
699 |
gr_update_english_exam_practice_tab_button = gr.update(variant="secondary")
|
700 |
+
|
701 |
elif selected_tab == "📊 英文段落寫作評分":
|
702 |
+
gr_update_english_grapragh_practice_row = gr.update(visible=False)
|
703 |
+
gr_update_english_grapragh_evaluate_row = gr.update(visible=True)
|
704 |
+
gr_update_english_exam_practice_row = gr.update(visible=False)
|
705 |
gr_update_english_grapragh_practice_button = gr.update(variant="secondary")
|
706 |
gr_update_english_grapragh_evaluate_button = gr.update(variant="primary")
|
707 |
gr_update_english_exam_practice_tab_button = gr.update(variant="secondary")
|
708 |
+
|
709 |
elif selected_tab == "🎯 英文考古題寫作練習":
|
710 |
+
gr_update_english_grapragh_practice_row = gr.update(visible=False)
|
711 |
+
gr_update_english_grapragh_evaluate_row = gr.update(visible=False)
|
712 |
+
gr_update_english_exam_practice_row = gr.update(visible=True)
|
713 |
gr_update_english_grapragh_practice_button = gr.update(variant="secondary")
|
714 |
gr_update_english_grapragh_evaluate_button = gr.update(variant="secondary")
|
715 |
gr_update_english_exam_practice_tab_button = gr.update(variant="primary")
|
716 |
+
|
717 |
+
return gr_update_english_grapragh_practice_row, \
|
718 |
+
gr_update_english_grapragh_evaluate_row, \
|
719 |
+
gr_update_english_exam_practice_row, \
|
720 |
gr_update_english_grapragh_practice_button, \
|
721 |
gr_update_english_grapragh_evaluate_button, \
|
722 |
gr_update_english_exam_practice_tab_button
|
|
|
749 |
english_grapragh_evaluate_button = gr.Button("📊 英文段落寫作評分")
|
750 |
with gr.Column():
|
751 |
english_exam_practice_tab_button = gr.Button("🎯 英文考古題寫作練習")
|
752 |
+
with gr.Row(visible=True) as english_grapragh_practice_row:
|
|
|
753 |
# ===== 英文段落寫作練習 =====
|
754 |
+
with gr.Column():
|
755 |
+
with gr.Row():
|
756 |
+
gr.Markdown("# 📝 英文段落寫作練習")
|
757 |
with gr.Row():
|
758 |
with gr.Column():
|
759 |
gr.Image(value="https://storage.googleapis.com/jutor/Jutor%E6%AE%B5%E8%90%BD%20banner.jpg", show_label=False, show_download_button=False)
|
|
|
1584 |
outputs=history_accordion
|
1585 |
)
|
1586 |
|
1587 |
+
with gr.Row(visible=False) as english_grapragh_evaluate_row:
|
1588 |
# ====="英文全文批改"=====
|
1589 |
+
with gr.Column():
|
1590 |
with gr.Row(visible=False) as full_paragraph_params:
|
1591 |
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.")
|
1592 |
default_user_generate_full_paragraph_evaluate_prompt = default_user_generate_paragraph_evaluate_prompt
|
1593 |
user_generate_full_paragraph_evaluate_prompt = gr.Textbox(label="Paragraph evaluate Prompt", value=default_user_generate_full_paragraph_evaluate_prompt, visible=False)
|
1594 |
+
with gr.Row():
|
1595 |
+
gr.Markdown("# 📊 英文段落寫作評分")
|
1596 |
# 輸入段落全文
|
1597 |
with gr.Row():
|
1598 |
+
gr.Markdown("## 輸入段落全文")
|
1599 |
with gr.Row():
|
1600 |
with gr.Column():
|
1601 |
full_paragraph_input = gr.Textbox(label="輸入段落全文", lines=5)
|
|
|
1686 |
outputs=[full_paragraph_save_output, full_audio_output]
|
1687 |
)
|
1688 |
|
1689 |
+
with gr.Row(visible=False) as english_exam_practice_row:
|
1690 |
# ====="英文考古題寫作練習====="
|
1691 |
+
with gr.Column():
|
1692 |
with gr.Row():
|
1693 |
with gr.Column():
|
1694 |
with gr.Row():
|
1695 |
+
gr.Markdown("# 🎯 英文考古題寫作練習")
|
1696 |
with gr.Row():
|
1697 |
gr.Markdown("## 選擇考古題")
|
1698 |
with gr.Row():
|
|
|
1803 |
outputs=past_exam_refine_output_diff
|
1804 |
)
|
1805 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1806 |
english_grapragh_practice_button.click(
|
1807 |
+
fn=update_english_grapragh_practice_rows,
|
1808 |
inputs=[english_grapragh_practice_button],
|
1809 |
outputs=[
|
1810 |
+
english_grapragh_practice_row,
|
1811 |
+
english_grapragh_evaluate_row,
|
1812 |
+
english_exam_practice_row,
|
1813 |
english_grapragh_practice_button,
|
1814 |
english_grapragh_evaluate_button,
|
1815 |
english_exam_practice_tab_button
|
1816 |
]
|
1817 |
)
|
1818 |
english_grapragh_evaluate_button.click(
|
1819 |
+
fn=update_english_grapragh_practice_rows,
|
1820 |
inputs=[english_grapragh_evaluate_button],
|
1821 |
outputs=[
|
1822 |
+
english_grapragh_practice_row,
|
1823 |
+
english_grapragh_evaluate_row,
|
1824 |
+
english_exam_practice_row,
|
1825 |
english_grapragh_practice_button,
|
1826 |
english_grapragh_evaluate_button,
|
1827 |
english_exam_practice_tab_button
|
1828 |
]
|
1829 |
)
|
1830 |
english_exam_practice_tab_button.click(
|
1831 |
+
fn=update_english_grapragh_practice_rows,
|
1832 |
inputs=[english_exam_practice_tab_button],
|
1833 |
outputs=[
|
1834 |
+
english_grapragh_practice_row,
|
1835 |
+
english_grapragh_evaluate_row,
|
1836 |
+
english_exam_practice_row,
|
1837 |
english_grapragh_practice_button,
|
1838 |
english_grapragh_evaluate_button,
|
1839 |
english_exam_practice_tab_button
|