adithya747's picture
Update app.py
66a4d52 verified
raw
history blame
536 Bytes
import gradio as gr
import requests
from bs4 import BeautifulSoup
def summarize_website(url):
try:
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
paragraphs = soup.find_all("p")
text = " ".join([p.get_text() for p in paragraphs[:5]])
return text if text else "No content found."
except Exception as e:
return f"Error: {str(e)}"
iface = gr.Interface(fn=summarize_website, inputs="text", outputs="text", title="Website Summarizer")
iface.launch()