Spaces:
Runtime error
Runtime error
import gradio as gr | |
from main import fetch_webpage_content, parse_and_segment_content, summarize_text | |
def summarize_webpage(url): | |
html_content = fetch_webpage_content(url) | |
if html_content: | |
chunks = parse_and_segment_content(html_content) | |
summary = summarize_text(chunks) | |
if summary: | |
return summary | |
else: | |
return "Failed to generate a summary." | |
else: | |
return "Failed to fetch or process webpage content." | |
interface = gr.Interface(fn=summarize_webpage, | |
inputs=gr.Textbox(lines=2, placeholder="Enter URL Here..."), | |
outputs="text", | |
title="Webpage Summarizer", | |
description="Paste the URL of a webpage to get a summarized content.") | |
if __name__ == "__main__": | |
interface.launch() |