Spaces:
Sleeping
Sleeping
mind map add
Browse files
app.py
CHANGED
@@ -3014,12 +3014,6 @@ def update_state(content_subject, content_grade, trascript, key_moments, questio
|
|
3014 |
HEAD = """
|
3015 |
<meta charset="UTF-8">
|
3016 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
3017 |
-
<style>
|
3018 |
-
svg.markmap {{
|
3019 |
-
width: 100%;
|
3020 |
-
height: 100vh;
|
3021 |
-
}}
|
3022 |
-
</style>
|
3023 |
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
|
3024 |
|
3025 |
<script>
|
@@ -3038,6 +3032,38 @@ HEAD = """
|
|
3038 |
</script>
|
3039 |
"""
|
3040 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3041 |
streaming_chat_greeting = """
|
3042 |
Hi,我是【飛特音速】,說話比較快,但有什麼問題都可以問我喔! \n
|
3043 |
🚀 我沒有預設問題、也沒有語音輸入,適合快問快答的你 \n
|
@@ -3052,7 +3078,7 @@ streaming_ai_chatbot = gr.Chatbot(
|
|
3052 |
show_copy_button=True,
|
3053 |
)
|
3054 |
|
3055 |
-
with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, secondary_hue=gr.themes.colors.amber, text_size = gr.themes.sizes.text_lg), head=HEAD) as demo:
|
3056 |
with gr.Row() as admin:
|
3057 |
password = gr.Textbox(label="Password", type="password", elem_id="password_input", visible=True)
|
3058 |
youtube_link = gr.Textbox(label="Enter YouTube Link", elem_id="youtube_link_input", visible=True)
|
@@ -3228,6 +3254,9 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
3228 |
with gr.Tab("重點摘要"):
|
3229 |
with gr.Row():
|
3230 |
df_summarise = gr.Markdown(show_label=False, latex_delimiters = [{"left": "$", "right": "$", "display": False}])
|
|
|
|
|
|
|
3231 |
with gr.Tab("關鍵時刻"):
|
3232 |
with gr.Row():
|
3233 |
key_moments_html = gr.HTML(value="")
|
@@ -3404,8 +3433,7 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
3404 |
with gr.Tab("markdown"):
|
3405 |
gr.Markdown("## 請複製以下 markdown 並貼到你的心智圖工具中,建議使用:https://markmap.js.org/repl")
|
3406 |
mind_map = gr.Textbox(container=True, show_copy_button=True, lines=40, elem_id="mind_map_markdown")
|
3407 |
-
|
3408 |
-
mind_map_html = gr.HTML()
|
3409 |
|
3410 |
# OPEN AI CHATBOT SELECT
|
3411 |
chatbot_select_outputs=[
|
|
|
3014 |
HEAD = """
|
3015 |
<meta charset="UTF-8">
|
3016 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
|
|
|
|
|
|
|
3017 |
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
|
3018 |
|
3019 |
<script>
|
|
|
3032 |
</script>
|
3033 |
"""
|
3034 |
|
3035 |
+
JS = """
|
3036 |
+
function createGradioAnimation() {
|
3037 |
+
const mind_map_tab_button = document.querySelector("#mind_map_tab-button");
|
3038 |
+
|
3039 |
+
if (mind_map_tab_button) {
|
3040 |
+
mind_map_tab_button.addEventListener('click', function() {
|
3041 |
+
const mind_map_markdown = document.querySelector("#mind_map_markdown > label > textarea");
|
3042 |
+
if (mind_map_markdown) {
|
3043 |
+
// 当按钮被点击时,打印当前的textarea的值
|
3044 |
+
console.log('Value changed to: ' + mind_map_markdown.value);
|
3045 |
+
markmap.autoLoader.renderAll();
|
3046 |
+
}
|
3047 |
+
});
|
3048 |
+
}
|
3049 |
+
|
3050 |
+
return 'Animation created';
|
3051 |
+
}
|
3052 |
+
"""
|
3053 |
+
|
3054 |
+
CSS = """
|
3055 |
+
#mind_map_tab {
|
3056 |
+
height: 500px;
|
3057 |
+
}
|
3058 |
+
.markmap {
|
3059 |
+
position: relative;
|
3060 |
+
}
|
3061 |
+
.markmap > svg {
|
3062 |
+
width: 100%;
|
3063 |
+
height: 600px;
|
3064 |
+
}
|
3065 |
+
"""
|
3066 |
+
|
3067 |
streaming_chat_greeting = """
|
3068 |
Hi,我是【飛特音速】,說話比較快,但有什麼問題都可以問我喔! \n
|
3069 |
🚀 我沒有預設問題、也沒有語音輸入,適合快問快答的你 \n
|
|
|
3078 |
show_copy_button=True,
|
3079 |
)
|
3080 |
|
3081 |
+
with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, secondary_hue=gr.themes.colors.amber, text_size = gr.themes.sizes.text_lg), head=HEAD, js=JS, css=CSS) as demo:
|
3082 |
with gr.Row() as admin:
|
3083 |
password = gr.Textbox(label="Password", type="password", elem_id="password_input", visible=True)
|
3084 |
youtube_link = gr.Textbox(label="Enter YouTube Link", elem_id="youtube_link_input", visible=True)
|
|
|
3254 |
with gr.Tab("重點摘要"):
|
3255 |
with gr.Row():
|
3256 |
df_summarise = gr.Markdown(show_label=False, latex_delimiters = [{"left": "$", "right": "$", "display": False}])
|
3257 |
+
with gr.Tab("心智圖",elem_id="mind_map_tab"):
|
3258 |
+
with gr.Row():
|
3259 |
+
mind_map_html = gr.HTML()
|
3260 |
with gr.Tab("關鍵時刻"):
|
3261 |
with gr.Row():
|
3262 |
key_moments_html = gr.HTML(value="")
|
|
|
3433 |
with gr.Tab("markdown"):
|
3434 |
gr.Markdown("## 請複製以下 markdown 並貼到你的心智圖工具中,建議使用:https://markmap.js.org/repl")
|
3435 |
mind_map = gr.Textbox(container=True, show_copy_button=True, lines=40, elem_id="mind_map_markdown")
|
3436 |
+
|
|
|
3437 |
|
3438 |
# OPEN AI CHATBOT SELECT
|
3439 |
chatbot_select_outputs=[
|