Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -94,10 +94,28 @@ def generate_zip_file(url):
|
|
94 |
|
95 |
# Gradio Interface
|
96 |
with gr.Blocks() as demo:
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
download_button = gr.Button("Download as ZIP")
|
99 |
output_file = gr.File(label="Download")
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
download_button.click(fn=generate_zip_file, inputs=url_input, outputs=output_file)
|
102 |
|
103 |
-
demo.launch()
|
|
|
94 |
|
95 |
# Gradio Interface
|
96 |
with gr.Blocks() as demo:
|
97 |
+
gr.Markdown("## Webpage to ZIP Downloader")
|
98 |
+
gr.Markdown("Enter a URL to download the webpage and its assets as a ZIP file.")
|
99 |
+
|
100 |
+
url_input = gr.Textbox(label="Website URL", placeholder="Enter a URL (e.g., https://www.example.com)")
|
101 |
+
|
102 |
+
# Examples Section
|
103 |
+
with gr.Accordion("Examples"):
|
104 |
+
gr.Markdown("### Example URLs:")
|
105 |
+
example1 = gr.Button("https://www.bmw.com/en/index.html")
|
106 |
+
example2 = gr.Button("https://www.ferrari.com/en-EN")
|
107 |
+
example3 = gr.Button("https://streamlit.io/")
|
108 |
+
|
109 |
download_button = gr.Button("Download as ZIP")
|
110 |
output_file = gr.File(label="Download")
|
111 |
|
112 |
+
def set_example_url(url):
|
113 |
+
url_input.value = url
|
114 |
+
|
115 |
+
example1.click(lambda: set_example_url("https://www.bmw.com/en/index.html"), [], url_input)
|
116 |
+
example2.click(lambda: set_example_url("https://www.ferrari.com/en-EN"), [], url_input)
|
117 |
+
example3.click(lambda: set_example_url("https://streamlit.io/"), [], url_input)
|
118 |
+
|
119 |
download_button.click(fn=generate_zip_file, inputs=url_input, outputs=output_file)
|
120 |
|
121 |
+
demo.launch()
|