File size: 283 Bytes
ccd2173
989abb3
ccd2173
 
 
 
 
1
2
3
4
5
6
7
from transformers import pipeline
import torch

def summarize_with_bart(text):
    pipe = pipeline("text2text-generation", model="EE21/Fine-tuned-BART-ToS-Summarization")
    summary = pipe(text, max_length=130, min_length=30, do_sample=False)[0]['generated_text']
    return summary