Spaces:
Running
Running
File size: 489 Bytes
f3bc981 d475e29 09f8d76 5edc6a5 09f8d76 5edc6a5 09f8d76 5edc6a5 09f8d76 5edc6a5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
import os
def generate_html(name, code):
try:
with open(f"{name}.html", "w") as f:
f.write(code)
return f"HTML file {name}.html generated successfully!"
except Exception as e:
return f"Error generating HTML file: {str(e)}"
demo = gr.Interface(
fn=generate_html,
inputs=[
gr.Textbox(label="File Name"),
gr.Code(label="HTML Code")
],
outputs="text",
title="HTML Generator"
)
demo.launch() |