import gradio as gr from generate_svg import main theme = gr.themes.Soft( primary_hue="purple", secondary_hue="cyan", neutral_hue="slate", font=[ gr.themes.GoogleFont("Syne"), gr.themes.GoogleFont("Poppins"), gr.themes.GoogleFont("Poppins"), gr.themes.GoogleFont("Poppins") ], ) with gr.Blocks(theme=theme, title="MarkDown SVG Generator", fill_height=True) as app: gr.HTML( value ="""

MarkDown SVG Generator

Designed and Developed by Nayan Kasturi

MarkDown SVG Generator for ReXplore

""") with gr.Row(): with gr.Column(): markdown = gr.Textbox(label="Markdown Text", placeholder="Enter the markdown text", lines=7) get_file = gr.Button(value="SVG File", variant="primary") svg_viewer = gr.Textbox(label="SVG Viewer", placeholder="SVG Viewer", lines=7, interactive=False, show_copy_button=True) get_file.click( main, inputs=[markdown], outputs=[svg_viewer], concurrency_limit=25, scroll_to_output=True, show_api=True, api_name="markdown_svg_generator", show_progress="full", ) import subprocess try: subprocess.run(["apt", "update"], check=True) subprocess.run(["apt-get", "install", "-y", "graphviz"], check=True) app.queue(default_concurrency_limit=25).launch(show_api=True, show_error=True, debug=True) except subprocess.CalledProcessError: print("Graphviz is not installed. Please install it using `apt install graphviz` and try again.") except Exception as e: print(f"An error occurred: {e}") raise e