import gradio as gr def svg_to_html(svg_file): # Read the SVG file content with open(svg_file.name, 'r') as file: svg_code = file.read() # Create a basic HTML template with the SVG code embedded html_content = f""" SVG to HTML {svg_code} """ return html_content, svg_code # Define the Gradio interface iface = gr.Interface( fn=svg_to_html, inputs=gr.File(label="Upload SVG File"), outputs=[ gr.Textbox(lines=15, label="Generated HTML"), gr.HTML(label="SVG Preview") ], title="SVG to HTML Converter", description="Upload an SVG file to see the generated HTML code and a preview of the SVG." ) # Launch the interface iface.launch()