Spaces:
Running
Running
File size: 963 Bytes
585747f ae02035 0a40653 585747f fe88e4d 77b211d 32e4ce7 585747f 32e4ce7 c875e8e 73c565e 3ee3c91 32e4ce7 73c565e efafbe1 965bec8 efafbe1 585747f d11c1e5 77b211d 32e4ce7 77b211d efafbe1 585747f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
import gradio as gr
import base64
#import execjs
# Define the Mermaid code for the flowchart
mermaid_code = """graph TD;
A[Start] --> B[Decision];
B -- Yes --> C[Option 1];
B -- No --> D[Option 2];
C --> E[End];
D --> E;
E[End] --> F[End];
"""
#def call_chart(mermaidCode):
def mm(graph):
code_out=""
for ea in mermaid_code.split("\n"):
code=ea.strip().strip("\n")
code_out+=code
out_html=f'''<div><iframe src="https://omnibus-mermaid-script.static.hf.space/index.html?mermaid={code_out}" height="500" width="500"></iframe></div>'''
return out_html
"""
graph LR;
A--> B & C & D;
B--> A & E;
C--> A & E;
D--> A & E;
E--> B & C & D;
"""
css="""
.flowchart-link{
stroke:red;
}
"""
with gr.Blocks() as app:
inp_text=gr.Textbox(value=mermaid_code)
btn=gr.Button()
out_html=gr.HTML("""""")
btn.click(mm,inp_text,out_html)
app.load(mm,inp_text,out_html)
app.launch() |