youngtsai commited on
Commit
15e1a1f
1 Parent(s): 27bd0db

with gr.Blocks(head=HEAD) as demo:

Browse files
Files changed (1) hide show
  1. app.py +30 -1
app.py CHANGED
@@ -812,7 +812,36 @@ def next_slide():
812
  def get_video_id():
813
  return VIDEO_ID
814
 
815
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
  with gr.Row():
817
  with gr.Column():
818
  file_upload = gr.File(label="Upload your CSV or Word file", visible=False)
 
812
  def get_video_id():
813
  return VIDEO_ID
814
 
815
+ HEAD = """
816
+ <meta charset="UTF-8">
817
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
818
+ <style>
819
+ svg.markmap {{
820
+ width: 100%;
821
+ height: 100vh;
822
+ }}
823
+ </style>
824
+ <script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@0.15.2"></script>
825
+
826
+ <script>
827
+ const mind_map_tab_button = document.querySelector("#mind_map_tab-button");
828
+
829
+ // 在30秒后设置事件监听
830
+ if (mind_map_tab_button) {
831
+ mind_map_tab_button.addEventListener('click', function() {
832
+ const mind_map_markdown = document.querySelector("#mind_map_markdown > label > textarea");
833
+ if (mind_map_markdown) {
834
+ // 当按钮被点击时,打印当前的textarea的值
835
+ console.log('Value changed to: ' + mind_map_markdown.value);
836
+ markmap.autoLoader.renderAll();
837
+ }
838
+ });
839
+ }
840
+ </script>
841
+ """
842
+
843
+
844
+ with gr.Blocks(head=HEAD) as demo:
845
  with gr.Row():
846
  with gr.Column():
847
  file_upload = gr.File(label="Upload your CSV or Word file", visible=False)