MHamdan's picture
Upload app.py with huggingface_hub
7eef865 verified
import gradio as gr
from smolagents import load_tool
web_extractor = load_tool("MHamdan/web-content-extractor", trust_remote_code=True)
def create_interface():
with gr.Blocks(title="Web Content Extractor") as iface:
gr.Markdown("# Web Content Extractor")
gr.Markdown("Extract and analyze content from any webpage.")
with gr.Row():
with gr.Column():
url_input = gr.Textbox(
label="Webpage URL",
placeholder="https://example.com"
)
content_type = gr.Dropdown(
choices=["all", "text", "links", "headers"],
label="Content Type",
value="all"
)
submit_btn = gr.Button("Extract Content")
with gr.Column():
output = gr.Textbox(
label="Extracted Content",
lines=10
)
submit_btn.click(
fn=web_extractor,
inputs=[url_input, content_type],
outputs=output
)
return iface
demo = create_interface()
demo.launch()