Spaces:
Sleeping
Sleeping
File size: 586 Bytes
bb04e10 e560413 dc00154 86a659b dc00154 055db97 bb04e10 e560413 bb04e10 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
from transformers import pipeline
import requests
def summarize_url(url):
r = requests.get(url)
url_contents = r.text
summarizer = pipeline("summarization",
model="facebook/bart-large-cnn",
max_length=1024, # or 512, or whatever your cut-off is
truncation=True
)
summarized_text = summarizer(url_contents, min_length=30, do_sample=False)
return summarized_text[0]['summary_text']
iface = gr.Interface(fn=summarize_url, inputs="text", outputs="text")
iface.launch() |