Spaces:
Sleeping
Sleeping
AI小精靈
Browse files
app.py
CHANGED
@@ -1486,75 +1486,51 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
1486 |
web_link = gr.Textbox(label="Enter Web Page Link", visible=False)
|
1487 |
user_data = gr.Textbox(label="User Data", elem_id="user_data_input", visible=True)
|
1488 |
youtube_link_btn = gr.Button("Submit_YouTube_Link", elem_id="youtube_link_btn", visible=True)
|
1489 |
-
with gr.Tab("
|
1490 |
-
with gr.
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
msg = gr.Textbox(label="Message")
|
1535 |
-
send_button = gr.Button("Send", variant="primary")
|
1536 |
-
with gr.Tab("GROQ", visible=False):
|
1537 |
-
groq_ai_name = gr.Textbox(label="AI 助理名稱", value="groq", visible=False)
|
1538 |
-
groq_chatbot = gr.Chatbot(avatar_images=[bot_avatar, user_avatar], label="groq mode chatbot", show_share_button=False, likeable=True)
|
1539 |
-
groq_msg = gr.Textbox(label="Message")
|
1540 |
-
groq_send_button = gr.Button("Send", variant="primary")
|
1541 |
-
with gr.Tab("JUTOR", visible=False):
|
1542 |
-
jutor_ai_name = gr.Textbox(label="AI 助理名稱", value="jutor", visible=False)
|
1543 |
-
jutor_chatbot = gr.Chatbot(avatar_images=[bot_avatar, user_avatar], label="jutor mode chatbot", show_share_button=False, likeable=True)
|
1544 |
-
jutor_msg = gr.Textbox(label="Message")
|
1545 |
-
jutor_send_button = gr.Button("Send", variant="primary")
|
1546 |
-
with gr.Tab("CLAUDE", visible=False):
|
1547 |
-
claude_ai_name = gr.Textbox(label="AI 助理名稱", value="claude3", visible=False)
|
1548 |
-
claude_chatbot = gr.Chatbot(avatar_images=[bot_avatar, user_avatar], label="claude mode chatbot", show_share_button=False, likeable=True)
|
1549 |
-
claude_msg = gr.Textbox(label="Message")
|
1550 |
-
claude_send_button = gr.Button("Send", variant="primary")
|
1551 |
-
with gr.Tab("ai_chatbot"):
|
1552 |
-
ai_name = gr.Dropdown(label="選擇 AI 助理", choices=["jutor", "claude3", "groq"], value="jutor")
|
1553 |
-
ai_chatbot = gr.Chatbot(avatar_images=[bot_avatar, user_avatar], label="ai_chatbot", show_share_button=False, likeable=True)
|
1554 |
-
ai_msg = gr.Textbox(label="Message")
|
1555 |
-
ai_send_button = gr.Button("Send", variant="primary")
|
1556 |
-
|
1557 |
-
with gr.Tab("教師版"):
|
1558 |
with gr.Row():
|
1559 |
content_subject = gr.Dropdown(label="選擇主題", choices=["數學", "自然", "國文", "英文", "社會","物理", "化學", "生物", "地理", "歷史", "公民"], value="", visible=False)
|
1560 |
content_grade = gr.Dropdown(label="選擇年級", choices=["一年級", "二年級", "三年級", "四年級", "五年級", "六年級", "七年級", "八年級", "九年級", "十年級", "十一年級", "十二年級"], value="", visible=False)
|
@@ -1640,7 +1616,27 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
1640 |
# metacognition_content = gr.Textbox(label="輸入後設認知相關問題")
|
1641 |
# metacognition_content_btn = gr.Button("生成後設認知問題")
|
1642 |
|
1643 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1644 |
# --- Event ---
|
1645 |
# OPENAI 模式
|
1646 |
send_button.click(
|
|
|
1486 |
web_link = gr.Textbox(label="Enter Web Page Link", visible=False)
|
1487 |
user_data = gr.Textbox(label="User Data", elem_id="user_data_input", visible=True)
|
1488 |
youtube_link_btn = gr.Button("Submit_YouTube_Link", elem_id="youtube_link_btn", visible=True)
|
1489 |
+
with gr.Tab("AI小精靈"):
|
1490 |
+
with gr.Column(scale=1):
|
1491 |
+
gr.Markdown("## 你也有類似的問題想問嗎?")
|
1492 |
+
btn_1 = gr.Button()
|
1493 |
+
btn_2 = gr.Button()
|
1494 |
+
btn_3 = gr.Button()
|
1495 |
+
gr.Markdown("## 重新生成問題")
|
1496 |
+
btn_create_question = gr.Button("生成其他問題", variant="primary")
|
1497 |
+
with gr.Column(scale=2):
|
1498 |
+
with gr.Tab("OPENAI"):
|
1499 |
+
bot_avatar = "https://junyi-avatar.s3.ap-northeast-1.amazonaws.com/live/%20%20foxcat-star-18.png?v=20231113095823614"
|
1500 |
+
user_avatar = "https://junyitopicimg.s3.amazonaws.com/s4byy--icon.jpe?v=20200513013523726"
|
1501 |
+
chatbot = gr.Chatbot(avatar_images=[bot_avatar, user_avatar], label="OPEN AI", show_share_button=False, likeable=True)
|
1502 |
+
thread_id = gr.Textbox(label="thread_id", visible=False)
|
1503 |
+
socratic_mode_btn = gr.Checkbox(label="蘇格拉底家教助理模式", value=True)
|
1504 |
+
openai_chatbot_audio_input = gr.Audio(sources=["microphone"], type="filepath")
|
1505 |
+
msg = gr.Textbox(label="Message")
|
1506 |
+
send_button = gr.Button("Send", variant="primary")
|
1507 |
+
with gr.Tab("GROQ", visible=False):
|
1508 |
+
groq_ai_name = gr.Textbox(label="AI 助理名稱", value="groq", visible=False)
|
1509 |
+
groq_chatbot = gr.Chatbot(avatar_images=[bot_avatar, user_avatar], label="groq mode chatbot", show_share_button=False, likeable=True)
|
1510 |
+
groq_msg = gr.Textbox(label="Message")
|
1511 |
+
groq_send_button = gr.Button("Send", variant="primary")
|
1512 |
+
with gr.Tab("JUTOR", visible=False):
|
1513 |
+
jutor_ai_name = gr.Textbox(label="AI 助理名稱", value="jutor", visible=False)
|
1514 |
+
jutor_chatbot = gr.Chatbot(avatar_images=[bot_avatar, user_avatar], label="jutor mode chatbot", show_share_button=False, likeable=True)
|
1515 |
+
jutor_msg = gr.Textbox(label="Message")
|
1516 |
+
jutor_send_button = gr.Button("Send", variant="primary")
|
1517 |
+
with gr.Tab("CLAUDE", visible=False):
|
1518 |
+
claude_ai_name = gr.Textbox(label="AI 助理名稱", value="claude3", visible=False)
|
1519 |
+
claude_chatbot = gr.Chatbot(avatar_images=[bot_avatar, user_avatar], label="claude mode chatbot", show_share_button=False, likeable=True)
|
1520 |
+
claude_msg = gr.Textbox(label="Message")
|
1521 |
+
claude_send_button = gr.Button("Send", variant="primary")
|
1522 |
+
with gr.Tab("ai_chatbot"):
|
1523 |
+
ai_name = gr.Dropdown(label="選擇 AI 助理", choices=["jutor", "claude3", "groq"], value="jutor")
|
1524 |
+
ai_chatbot = gr.Chatbot(avatar_images=[bot_avatar, user_avatar], label="ai_chatbot", show_share_button=False, likeable=True)
|
1525 |
+
ai_msg = gr.Textbox(label="Message")
|
1526 |
+
ai_send_button = gr.Button("Send", variant="primary")
|
1527 |
+
with gr.Tab("文章模式"):
|
1528 |
+
reading_passage = gr.Textbox(label="Reading Passage", lines=40, show_label=False)
|
1529 |
+
reading_passage_speak_button = gr.Button("Speak", visible=False)
|
1530 |
+
reading_passage_audio_output = gr.Audio(label="Audio Output", visible=False)
|
1531 |
+
with gr.Tab("重點摘要"):
|
1532 |
+
df_summarise = gr.Textbox(container=True, show_copy_button=True, lines=40, show_label=False)
|
1533 |
+
with gr.Tab("教學備課"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1534 |
with gr.Row():
|
1535 |
content_subject = gr.Dropdown(label="選擇主題", choices=["數學", "自然", "國文", "英文", "社會","物理", "化學", "生物", "地理", "歷史", "公民"], value="", visible=False)
|
1536 |
content_grade = gr.Dropdown(label="選擇年級", choices=["一年級", "二年級", "三年級", "四年級", "五年級", "六年級", "七年級", "八年級", "九年級", "十年級", "十一年級", "十二年級"], value="", visible=False)
|
|
|
1616 |
# metacognition_content = gr.Textbox(label="輸入後設認知相關問題")
|
1617 |
# metacognition_content_btn = gr.Button("生成後設認知問題")
|
1618 |
|
1619 |
+
with gr.Accordion("See Details", open=False):
|
1620 |
+
with gr.Tab("本文"):
|
1621 |
+
df_string_output = gr.Textbox(lines=40, label="Data Text")
|
1622 |
+
with gr.Tab("逐字稿"):
|
1623 |
+
simple_html_content = gr.HTML(label="Simple Transcript")
|
1624 |
+
with gr.Tab("圖文"):
|
1625 |
+
transcript_html = gr.HTML(label="YouTube Transcript and Video")
|
1626 |
+
with gr.Tab("投影片"):
|
1627 |
+
slide_image = gr.Image()
|
1628 |
+
slide_text = gr.Textbox()
|
1629 |
+
with gr.Row():
|
1630 |
+
prev_button = gr.Button("Previous")
|
1631 |
+
next_button = gr.Button("Next")
|
1632 |
+
prev_button.click(fn=prev_slide, inputs=[], outputs=[slide_image, slide_text])
|
1633 |
+
next_button.click(fn=next_slide, inputs=[], outputs=[slide_image, slide_text])
|
1634 |
+
with gr.Tab("markdown"):
|
1635 |
+
gr.Markdown("## 請複製以下 markdown 並貼到你的心智圖工具中,建議使用:https://markmap.js.org/repl")
|
1636 |
+
mind_map = gr.Textbox(container=True, show_copy_button=True, lines=40, elem_id="mind_map_markdown")
|
1637 |
+
with gr.Tab("心智圖",elem_id="mind_map_tab"):
|
1638 |
+
mind_map_html = gr.HTML()
|
1639 |
+
|
1640 |
# --- Event ---
|
1641 |
# OPENAI 模式
|
1642 |
send_button.click(
|