youngtsai commited on
Commit
9d36b77
โ€ข
1 Parent(s): 1151c0f

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

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -453,7 +453,7 @@ def generate_mind_map(df_string):
453
  }
454
 
455
  response = client.chat.completions.create(**request_payload)
456
- mind_map = response.choices[0].message.content.strip().replace("```markdown", "").replace("```", "")
457
  print("=====mind_map=====")
458
  print(mind_map)
459
  print("=====mind_map=====")
@@ -811,19 +811,20 @@ def next_slide():
811
  def get_video_id():
812
  return VIDEO_ID
813
 
814
- JS = """
815
- <script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@0.15.2"></script>
816
- """
817
-
818
- CSS = """
819
  svg.markmap {{
820
  width: 100%;
821
  height: 100vh;
822
  }}
 
 
823
  """
824
 
825
 
826
- with gr.Blocks(js=JS, css=CSS) as demo:
827
  with gr.Row():
828
  with gr.Column():
829
  file_upload = gr.File(label="Upload your CSV or Word file", visible=False)
@@ -857,7 +858,7 @@ with gr.Blocks(js=JS, css=CSS) as demo:
857
  gr.Markdown("## ้‡ๆ–ฐ็”Ÿๆˆๅ•้กŒ")
858
  btn_create_question = gr.Button("Create Questions")
859
  with gr.Tab("markdown"):
860
- mind_map = gr.Textbox(container=True, show_copy_button=True, lines=40)
861
  with gr.Tab("ๅฟƒๆ™บๅœ–"):
862
  mind_map_html = gr.HTML()
863
 
 
453
  }
454
 
455
  response = client.chat.completions.create(**request_payload)
456
+ mind_map = response.choices[0].message.content.strip()
457
  print("=====mind_map=====")
458
  print(mind_map)
459
  print("=====mind_map=====")
 
811
  def get_video_id():
812
  return VIDEO_ID
813
 
814
+ HEAD = """
815
+ <meta charset="UTF-8">
816
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
817
+ <style>
 
818
  svg.markmap {{
819
  width: 100%;
820
  height: 100vh;
821
  }}
822
+ </style>
823
+ <script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@0.15.2"></script>
824
  """
825
 
826
 
827
+ with gr.Blocks(head=HEAD) as demo:
828
  with gr.Row():
829
  with gr.Column():
830
  file_upload = gr.File(label="Upload your CSV or Word file", visible=False)
 
858
  gr.Markdown("## ้‡ๆ–ฐ็”Ÿๆˆๅ•้กŒ")
859
  btn_create_question = gr.Button("Create Questions")
860
  with gr.Tab("markdown"):
861
+ mind_map = gr.Textbox()
862
  with gr.Tab("ๅฟƒๆ™บๅœ–"):
863
  mind_map_html = gr.HTML()
864