Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,8 +11,7 @@ mm_html="""
|
|
| 11 |
B-->D(fa:fa-spinner);
|
| 12 |
</pre>"""
|
| 13 |
|
| 14 |
-
mermaid_code = """
|
| 15 |
-
graph TD;
|
| 16 |
A[Start] --> B[Decision]
|
| 17 |
B -- Yes --> C[Option 1]
|
| 18 |
B -- No --> D[Option 2]
|
|
@@ -33,7 +32,7 @@ js_c=("""
|
|
| 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
|
| 37 |
return gr.update(out_html)
|
| 38 |
|
| 39 |
"""
|
|
@@ -50,7 +49,8 @@ graph LR;
|
|
| 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()
|
|
|
|
| 11 |
B-->D(fa:fa-spinner);
|
| 12 |
</pre>"""
|
| 13 |
|
| 14 |
+
mermaid_code = """graph TD;
|
|
|
|
| 15 |
A[Start] --> B[Decision]
|
| 16 |
B -- Yes --> C[Option 1]
|
| 17 |
B -- No --> D[Option 2]
|
|
|
|
| 32 |
|
| 33 |
#def call_chart(mermaidCode):
|
| 34 |
def mm(graph=mermaid_code):
|
| 35 |
+
out_html=f'<iframe src="https://omnibus-mermaid-script.static.hf.space/?mermaid="+{graph}></iframe>'
|
| 36 |
return gr.update(out_html)
|
| 37 |
|
| 38 |
"""
|
|
|
|
| 49 |
|
| 50 |
with gr.Blocks() as app:
|
| 51 |
inp_text=gr.Textbox(value=mermaid_code)
|
| 52 |
+
btn=gr.Button()
|
| 53 |
out_html=gr.HTML()
|
| 54 |
+
btn.click(mm,inp_text,out_html)
|
| 55 |
app.load(mm,inp_text,out_html)
|
| 56 |
app.launch()
|