import gradio as gr from smolagents import load_tool import json analyzer = load_tool("MHamdan/web-analyzer", trust_remote_code=True) def create_interface(): with gr.Blocks(title="Web Content Analyzer") as iface: gr.Markdown("# 🌐 Web Content Analyzer") gr.Markdown(""" Get AI-powered analysis of any webpage: * 📝 Smart Summary * 😊 Sentiment Analysis * 📊 Content Statistics """) url_input = gr.Textbox( label="Webpage URL", placeholder="https://example.com" ) analyze_btn = gr.Button("Analyze") output = gr.JSON(label="Analysis Results") # Examples examples = [ ["https://www.artificialintelligence-news.com/2024/02/14/openai-anthropic-google-white-house-red-teaming/"], ["https://www.artificialintelligence-news.com/2024/02/13/ai-21-labs-wordtune-chatgpt-plugin/"] ] gr.Examples( examples=examples, inputs=url_input, outputs=output, fn=analyzer, cache_examples=True ) analyze_btn.click( fn=analyzer, inputs=url_input, outputs=output ) return iface demo = create_interface() demo.launch()