tmp-download / app.py
albertvillanova's picture
Update app.py
9b63141 verified
raw
history blame
672 Bytes
import gradio as gr
def generate_html():
return "<p>This is a sample HTML content.</p>"
def download_html(content):
with open("content.html", "w") as file:
file.write(content)
return "content.html"
html_component = gr.HTML(generate_html)
# download_button = gr.DownloadButton(label="Download HTML", inputs=html_component, value=download_html)
download_button = gr.DownloadButton(label="Download HTML")
interface = gr.Interface(fn=generate_html,
inputs=None,
outputs=[html_component, download_button])
download_button.click(
fn=download_html,
inputs=html_component,
)
interface.launch()