import gradio as gr
# HTML template for rendering Mermaid diagrams
html_template = """
{}
"""
def render_mermaid(mermaid_code):
# Wrap the input code into the HTML template
html_content = html_template.format(mermaid_code)
return html_content
# Create a Gradio interface
iface = gr.Interface(
fn=render_mermaid,
inputs="text",
outputs="html",
title="Mermaid Diagram Renderer",
description="Input your Mermaid diagram code to render it."
)
# Launch the app
iface.launch()