Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -21,15 +21,27 @@ js_c=("""
|
|
21 |
}
|
22 |
""")
|
23 |
|
24 |
-
def call_chart(mermaidCode):
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
with gr.Blocks() as app:
|
31 |
inp_text=gr.Textbox(value=mermaid_code)
|
32 |
|
33 |
out_html=gr.HTML("""<div id='diagram'>Text</div>""")
|
34 |
-
app.load(
|
35 |
app.launch()
|
|
|
21 |
}
|
22 |
""")
|
23 |
|
24 |
+
#def call_chart(mermaidCode):
|
25 |
+
def mm(graph):
|
26 |
+
graphbytes = graph.encode("utf8")
|
27 |
+
base64_bytes = base64.b64encode(graphbytes)
|
28 |
+
base64_string = base64_bytes.decode("ascii")
|
29 |
+
#display(Image(url="https://mermaid.ink/img/" + base64_string))
|
30 |
+
out_im=f"""<img src="https://mermaid.ink/img/" + {base64_string}"""
|
31 |
+
return gr.update(out_im0
|
32 |
+
|
33 |
+
"""
|
34 |
+
graph LR;
|
35 |
+
A--> B & C & D;
|
36 |
+
B--> A & E;
|
37 |
+
C--> A & E;
|
38 |
+
D--> A & E;
|
39 |
+
E--> B & C & D;
|
40 |
+
"""
|
41 |
|
42 |
with gr.Blocks() as app:
|
43 |
inp_text=gr.Textbox(value=mermaid_code)
|
44 |
|
45 |
out_html=gr.HTML("""<div id='diagram'>Text</div>""")
|
46 |
+
app.load(mm,inp_text,out_html)
|
47 |
app.launch()
|