|
from transformers import pipeline, BartForConditionalGeneration, BartTokenizer |
|
|
|
|
|
|
|
tokenizer_directory = '/Users/vishnu/Downloads/BART model small/model' |
|
|
|
|
|
tokenizer = BartTokenizer.from_pretrained('facebook/bart-large-cnn') |
|
|
|
|
|
|
|
|
|
|
|
model_directory = './model' |
|
tokenizer = BartTokenizer.from_pretrained(model_directory) |
|
model = BartForConditionalGeneration.from_pretrained(model_directory) |
|
|
|
|
|
summarizer = pipeline('summarization', model=model, tokenizer=tokenizer) |
|
|
|
|
|
article = """ |
|
That fucking Putin,” Biden said to advisers in the Oval Office not long after Russia invasion of Ukraine, according to Woodward. “Putin is evil. We are dealing with the epitome of evil.” |
|
|
|
The book, “War,” also reveals new details about Donald Trump private conversations with Putin and a secret shipment of Covid-19 testing equipment Trump sent to the Russian president for his personal use during the height of the pandemic. Trump has denied those reports. |
|
|
|
Woodwards new book, which was obtained by CNN ahead of its October 15 release, gives an unvarnished, in-the-room account of key moments as Biden and his national security team navigate international crises, from the disastrous Afghanistan withdrawal to confronting Putin before he invaded Ukraine to private battles with Netanyahu. |
|
|
|
Based on hundreds of hours of interviews with firsthand participants, “War” is filled with newly reported details of high-stakes showdowns. The book explores the political and personal wars that Biden has fought during his presidency, including details about his decision to step aside from the 2024 campaign and conversations about his son Hunter Bidens legal troubles. |
|
|
|
Among the new details in “War”: |
|
|
|
Woodward writes that Bidens national security team at one point believed there was a real threat, a 50hance, that Putin would use nuclear weapons in Ukraine. |
|
|
|
Biden said he “should never have picked” Attorney General Merrick Garland during a conversation over his sons legal troubles. |
|
|
|
Biden criticized former President Barack Obamas handling of Putins invasion of Crimea in 2014, concluding that “Barack never took Putin seriously.” |
|
|
|
Citing a Trump aide, Woodward reports that there have been “maybe as many as seven” calls between Trump and Putin since Trump left the White House in 2021. |
|
|
|
In a statement, Trump spokesman Steven Cheung said Trump gave Woodward “absolutely no access” for the book. “None of these made up stories by Bob Woodward are true,” he said. |
|
|
|
Asked about the details that Woodward reports about Biden and Netanyahu, White House senior deputy press secretary Emilie Simons told reporters Tuesday, “They have a long-term relationship. They have a very honest and direct relationship, and I dont have a comment on those specific anecdotes.” |
|
""" |
|
|
|
|
|
summary = summarizer(article, max_length=128, min_length=30, length_penalty=2.0, num_beams=4, early_stopping=True) |
|
|
|
|
|
print("\n\n Summary:", summary[0]['summary_text']) |