# Import necessary libraries from transformers import pipeline class ContentSummarizer: def __init__(self, data): self.data = data self.summarizer = pipeline('summarization') def summarize(self): summaries = [] for index, row in self.data.iterrows(): summary = self.summarizer(row['content'], max_length=150, min_length=30, do_sample=False) summaries.append({'url': row['url'], 'summary': summary[0]['summary_text']}) return summaries