Spaces:
Runtime error
Runtime error
Commit
•
9c80a11
1
Parent(s):
3002c4f
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def generate_html():
|
4 |
+
return "<p>This is a sample HTML content.</p>"
|
5 |
+
|
6 |
+
def download_html(content):
|
7 |
+
with open("content.html", "w") as file:
|
8 |
+
file.write(content)
|
9 |
+
return "content.html"
|
10 |
+
|
11 |
+
html_component = gr.HTML(generate_html)
|
12 |
+
download_button = gr.DownloadButton(label="Download HTML", inputs=html_component, outputs=download_html)
|
13 |
+
|
14 |
+
interface = gr.Interface(fn=generate_html,
|
15 |
+
inputs=None,
|
16 |
+
outputs=[html_component, download_button])
|
17 |
+
|
18 |
+
interface.launch()
|