File size: 358 Bytes
06e5a9b
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
from transformers import pipeline

summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")

def summarize_findings(results):
    text = "\n".join([f"{r['url']} ({r.get('tech')})" for r in results if "url" in r])
    if len(text) < 100:
        return "Not enough data to summarize."
    return summarizer(text[:1024])[0]['summary_text']