import gradio as gr from gradio.mix import Parallel, Series from transformers import pipeline import wikipedia def extract_article_text(url): text = wikipedia.page(pageid=url).content return text extractor = gr.Interface(extract_article_text, 'text', 'text') summarizer = gr.Interface.load("huggingface/facebook/bart-large-cnn") sample_url = [[1691376],[45199431]] description = ''' This application summarizes a news article based on the sentences used in the article. Enter a news article link and submit for a summary. A shorter news article produces a faster summary. A news article behind a paywall may produce an error. ''' iface = Series(extractor, summarizer, inputs = gr.inputs.Textbox( lines = 2, label = 'URL' ), outputs = 'text', title = 'Extractive News Summarizer BART', theme = 'grass', description = description, examples=sample_url) iface.launch()