Omnibus commited on
Commit
efafbe1
1 Parent(s): fe88e4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -32,13 +32,9 @@ js_c=("""
32
  """)
33
 
34
  #def call_chart(mermaidCode):
35
- def mm(graph):
36
- graphbytes = graph.encode("utf8")
37
- base64_bytes = base64.b64encode(graphbytes)
38
- base64_string = base64_bytes.decode("ascii")
39
- #display(Image(url="https://mermaid.ink/img/" + base64_string))
40
- out_im=f"""<img src="https://mermaid.ink/img/" + {base64_string}>"""
41
- return gr.update(out_im)
42
 
43
  """
44
  graph LR;
@@ -48,10 +44,13 @@ graph LR;
48
  D--> A & E;
49
  E--> B & C & D;
50
  """
51
-
 
 
 
52
  with gr.Blocks() as app:
53
  inp_text=gr.Textbox(value=mermaid_code)
54
 
55
- out_html=gr.HTML(mm_html)
56
- #app.load(mm,inp_text,out_html)
57
  app.launch()
 
32
  """)
33
 
34
  #def call_chart(mermaidCode):
35
+ def mm(graph=mermaid_code):
36
+ out_html=f'<iframe src="https://omnibus-mermaid-script.static.hf.space?mermaid="+{graph}></iframe>'
37
+ return gr.update(out_html)
 
 
 
 
38
 
39
  """
40
  graph LR;
 
44
  D--> A & E;
45
  E--> B & C & D;
46
  """
47
+
48
+
49
+
50
+
51
  with gr.Blocks() as app:
52
  inp_text=gr.Textbox(value=mermaid_code)
53
 
54
+ out_html=gr.HTML()
55
+ app.load(mm,inp_text,out_html)
56
  app.launch()