Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import base64
|
| 3 |
|
| 4 |
-
# HTML template for rendering Mermaid diagrams
|
| 5 |
html_template = """
|
| 6 |
<!DOCTYPE html>
|
| 7 |
<html>
|
|
@@ -35,14 +34,19 @@ def render_mermaid(mermaid_code):
|
|
| 35 |
|
| 36 |
return html_content, png_url
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
# Launch the app
|
| 48 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import base64
|
| 3 |
|
|
|
|
| 4 |
html_template = """
|
| 5 |
<!DOCTYPE html>
|
| 6 |
<html>
|
|
|
|
| 34 |
|
| 35 |
return html_content, png_url
|
| 36 |
|
| 37 |
+
with gr.Blocks(theme=gr.themes.Citrus()) as mrender:
|
| 38 |
+
gr.Markdown("# Mermaid Diagram Renderer")
|
| 39 |
+
gr.Markdown("Input your Mermaid diagram code to render it and get a PNG image.")
|
| 40 |
+
|
| 41 |
+
with gr.Row():
|
| 42 |
+
with gr.Column():
|
| 43 |
+
mermaid_input = gr.Textbox(label="Mermaid Code", placeholder="Enter your Mermaid diagram code here...")
|
| 44 |
+
submit_btn = gr.Button("Render")
|
| 45 |
+
with gr.Column():
|
| 46 |
+
html_output = gr.HTML()
|
| 47 |
+
image_output = gr.Image()
|
| 48 |
+
|
| 49 |
+
submit_btn.click(fn=render_mermaid, inputs=mermaid_input, outputs=[html_output, image_output])
|
| 50 |
|
| 51 |
# Launch the app
|
| 52 |
+
mrender.launch()
|