Spaces:
Sleeping
Sleeping
tab
Browse files
app.py
CHANGED
@@ -1091,7 +1091,6 @@ def respond_with_jutor_chat(password, user_message, data, chat_history, socratic
|
|
1091 |
print(f"Error: {response.status_code}")
|
1092 |
return "请求失败,请稍后再试!", chat_history
|
1093 |
|
1094 |
-
|
1095 |
def chat_with_groq(password, user_message, data, chat_history, socratic_mode=False):
|
1096 |
verify_password(password)
|
1097 |
|
@@ -1178,7 +1177,6 @@ def chat_with_groq(password, user_message, data, chat_history, socratic_mode=Fal
|
|
1178 |
# 返回聊天历史和空字符串清空输入框
|
1179 |
return "", chat_history
|
1180 |
|
1181 |
-
|
1182 |
def chat_with_youtube_transcript(password, youtube_id, thread_id, trascript, user_message, chat_history, socratic_mode=False):
|
1183 |
verify_password(password)
|
1184 |
|
@@ -1392,82 +1390,85 @@ HEAD = """
|
|
1392 |
|
1393 |
with gr.Blocks() as demo:
|
1394 |
with gr.Row():
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
|
|
|
|
1442 |
|
1443 |
-
with gr.
|
1444 |
-
gr.
|
1445 |
-
|
1446 |
-
with gr.
|
1447 |
-
with gr.
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
|
|
1471 |
# 傳統模式
|
1472 |
# send_button.click(
|
1473 |
# respond,
|
@@ -1555,4 +1556,11 @@ with gr.Blocks() as demo:
|
|
1555 |
# 当输入网页链接时触发
|
1556 |
# web_link.change(process_web_link, inputs=web_link, outputs=[btn_1, btn_2, btn_3, df_summarise, df_string_output])
|
1557 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1558 |
demo.launch(allowed_paths=["videos"])
|
|
|
1091 |
print(f"Error: {response.status_code}")
|
1092 |
return "请求失败,请稍后再试!", chat_history
|
1093 |
|
|
|
1094 |
def chat_with_groq(password, user_message, data, chat_history, socratic_mode=False):
|
1095 |
verify_password(password)
|
1096 |
|
|
|
1177 |
# 返回聊天历史和空字符串清空输入框
|
1178 |
return "", chat_history
|
1179 |
|
|
|
1180 |
def chat_with_youtube_transcript(password, youtube_id, thread_id, trascript, user_message, chat_history, socratic_mode=False):
|
1181 |
verify_password(password)
|
1182 |
|
|
|
1390 |
|
1391 |
with gr.Blocks() as demo:
|
1392 |
with gr.Row():
|
1393 |
+
password = gr.Textbox(label="Password", type="password", elem_id="password_input")
|
1394 |
+
file_upload = gr.File(label="Upload your CSV or Word file", visible=False)
|
1395 |
+
youtube_link = gr.Textbox(label="Enter YouTube Link", elem_id="youtube_link_input")
|
1396 |
+
video_id = gr.Textbox(label="video_id", visible=False)
|
1397 |
+
youtube_link_btn = gr.Button("Submit_YouTube_Link")
|
1398 |
+
web_link = gr.Textbox(label="Enter Web Page Link", visible=False)
|
1399 |
+
with gr.Tab("學生版"):
|
1400 |
+
with gr.Row():
|
1401 |
+
with gr.Column(scale=2):
|
1402 |
+
gr.Markdown("## OPEN AI 模式")
|
1403 |
+
chatbot = gr.Chatbot()
|
1404 |
+
thread_id = gr.Textbox(label="thread_id", visible=False)
|
1405 |
+
socratic_mode_btn = gr.Checkbox(label="蘇格拉底家教助理模式", value=False)
|
1406 |
+
msg = gr.Textbox(label="Message")
|
1407 |
+
send_button = gr.Button("Send")
|
1408 |
+
gr.Markdown("## GROQ 模式")
|
1409 |
+
groq_chatbot = gr.Chatbot(label="groq mode chatbot")
|
1410 |
+
groq_msg = gr.Textbox(label="Message")
|
1411 |
+
groq_send_button = gr.Button("Send")
|
1412 |
+
|
1413 |
+
with gr.Column(scale=3):
|
1414 |
+
with gr.Tab("圖文"):
|
1415 |
+
transcript_html = gr.HTML(label="YouTube Transcript and Video")
|
1416 |
+
with gr.Tab("投影片"):
|
1417 |
+
slide_image = gr.Image()
|
1418 |
+
slide_text = gr.Textbox()
|
1419 |
+
with gr.Row():
|
1420 |
+
prev_button = gr.Button("Previous")
|
1421 |
+
next_button = gr.Button("Next")
|
1422 |
+
prev_button.click(fn=prev_slide, inputs=[], outputs=[slide_image, slide_text])
|
1423 |
+
next_button.click(fn=next_slide, inputs=[], outputs=[slide_image, slide_text])
|
1424 |
+
with gr.Tab("逐字稿"):
|
1425 |
+
simple_html_content = gr.HTML(label="Simple Transcript")
|
1426 |
+
with gr.Tab("本文"):
|
1427 |
+
df_string_output = gr.Textbox(lines=40, label="Data Text")
|
1428 |
+
with gr.Tab("重點"):
|
1429 |
+
df_summarise = gr.Textbox(container=True, show_copy_button=True, lines=40)
|
1430 |
+
with gr.Tab("問題"):
|
1431 |
+
gr.Markdown("## 常用問題")
|
1432 |
+
btn_1 = gr.Button()
|
1433 |
+
btn_2 = gr.Button()
|
1434 |
+
btn_3 = gr.Button()
|
1435 |
+
gr.Markdown("## 重新生成問題")
|
1436 |
+
btn_create_question = gr.Button("Create Questions")
|
1437 |
+
with gr.Tab("markdown"):
|
1438 |
+
gr.Markdown("## 請複製以下 markdown 並貼到你的心智圖工具中,建議使用:https://markmap.js.org/repl")
|
1439 |
+
mind_map = gr.Textbox(container=True, show_copy_button=True, lines=40, elem_id="mind_map_markdown")
|
1440 |
+
with gr.Tab("心智圖",elem_id="mind_map_tab"):
|
1441 |
+
mind_map_html = gr.HTML()
|
1442 |
|
1443 |
+
with gr.Tab("教師版"):
|
1444 |
+
with gr.Row():
|
1445 |
+
gr.Markdown("## 教育評量饗宴")
|
1446 |
+
with gr.Row():
|
1447 |
+
with gr.Column(scale=2):
|
1448 |
+
with gr.Tab("認知階層評量題目"):
|
1449 |
+
cognitive_level_content = gr.Textbox(label="輸入學習目標與內容")
|
1450 |
+
cognitive_level_content_btn = gr.Button("生成評量題目")
|
1451 |
+
with gr.Tab("素養導向閱讀題組"):
|
1452 |
+
literacy_oriented_reading_content = gr.Textbox(label="輸入閱讀材料")
|
1453 |
+
literacy_oriented_reading_content_btn = gr.Button("生成閱讀理解題")
|
1454 |
+
with gr.Tab("學習單"):
|
1455 |
+
worksheet_content = gr.Textbox(label="輸入學習單內容")
|
1456 |
+
worksheet_content_btn = gr.Button("生成學習單")
|
1457 |
+
with gr.Tab("自我評估"):
|
1458 |
+
self_assessment_content = gr.Textbox(label="輸入自評問卷或檢查表")
|
1459 |
+
self_assessment_content_btn = gr.Button("生成自評問卷")
|
1460 |
+
with gr.Tab("自我反思評量"):
|
1461 |
+
self_reflection_content = gr.Textbox(label="輸入自我反思活動")
|
1462 |
+
self_reflection_content_btn = gr.Button("生成自我反思活動")
|
1463 |
+
with gr.Tab("後設認知"):
|
1464 |
+
metacognition_content = gr.Textbox(label="輸入後設認知相關問題")
|
1465 |
+
metacognition_content_btn = gr.Button("生成後設認知問題")
|
1466 |
+
with gr.Column(scale=3):
|
1467 |
+
# 生成對應不同模式的結果
|
1468 |
+
exam_result = gr.Textbox("生成結果")
|
1469 |
+
|
1470 |
+
|
1471 |
+
|
1472 |
# 傳統模式
|
1473 |
# send_button.click(
|
1474 |
# respond,
|
|
|
1556 |
# 当输入网页链接时触发
|
1557 |
# web_link.change(process_web_link, inputs=web_link, outputs=[btn_1, btn_2, btn_3, df_summarise, df_string_output])
|
1558 |
|
1559 |
+
# 教師版 學習單
|
1560 |
+
worksheet_content_btn.click(
|
1561 |
+
generate_worksheet,
|
1562 |
+
inputs=[password, worksheet_content],
|
1563 |
+
outputs=[exam_result]
|
1564 |
+
)
|
1565 |
+
|
1566 |
demo.launch(allowed_paths=["videos"])
|