Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,8 +5,7 @@ import mistune
|
|
| 5 |
|
| 6 |
def process(url: str):
|
| 7 |
"""
|
| 8 |
-
|
| 9 |
-
تولید HTML برای نمایش در رابط کاربری
|
| 10 |
"""
|
| 11 |
# اجرای تابع وباسکرپر
|
| 12 |
result = scrape_to_markdown(url)
|
|
@@ -27,20 +26,20 @@ def process(url: str):
|
|
| 27 |
|
| 28 |
# رابط کاربری Gradio
|
| 29 |
with gr.Blocks(css="style.css") as demo:
|
| 30 |
-
gr.Markdown("## 🌐 Web to Markdown Converter")
|
| 31 |
|
| 32 |
with gr.Row():
|
| 33 |
-
url_input = gr.Textbox(label="🔗
|
| 34 |
-
submit_btn = gr.Button("
|
| 35 |
|
| 36 |
with gr.Tab("📄 Markdown"):
|
| 37 |
-
md_output = gr.Textbox(label="
|
| 38 |
|
| 39 |
-
with gr.Tab("💾
|
| 40 |
-
file_output = gr.File(label="
|
| 41 |
|
| 42 |
-
with gr.Tab("🌍
|
| 43 |
-
html_output = gr.HTML(label="
|
| 44 |
|
| 45 |
submit_btn.click(process, inputs=url_input, outputs=[md_output, file_output, html_output])
|
| 46 |
|
|
|
|
| 5 |
|
| 6 |
def process(url: str):
|
| 7 |
"""
|
| 8 |
+
Get website link -> Extract content -> Save in Markdown file -> Generate HTML for display in user interface.
|
|
|
|
| 9 |
"""
|
| 10 |
# اجرای تابع وباسکرپر
|
| 11 |
result = scrape_to_markdown(url)
|
|
|
|
| 26 |
|
| 27 |
# رابط کاربری Gradio
|
| 28 |
with gr.Blocks(css="style.css") as demo:
|
| 29 |
+
gr.Markdown("## 🌐 Web to Markdown Scraper and Converter")
|
| 30 |
|
| 31 |
with gr.Row():
|
| 32 |
+
url_input = gr.Textbox(label="🔗 Enter the website link", placeholder="https://example.com")
|
| 33 |
+
submit_btn = gr.Button("🔥 Content Extraction")
|
| 34 |
|
| 35 |
with gr.Tab("📄 Markdown"):
|
| 36 |
+
md_output = gr.Textbox(label="Markdown Content", lines=20)
|
| 37 |
|
| 38 |
+
with gr.Tab("💾 Download"):
|
| 39 |
+
file_output = gr.File(label="Download Markdown file")
|
| 40 |
|
| 41 |
+
with gr.Tab("🌍 Preview HTML"):
|
| 42 |
+
html_output = gr.HTML(label="HTML View")
|
| 43 |
|
| 44 |
submit_btn.click(process, inputs=url_input, outputs=[md_output, file_output, html_output])
|
| 45 |
|