News article summariser
Paste a news URL or text and get a short summary, comparing an extractive method with a transformer model.
Intermediateâą 6â10 hoursđĒ 7 stepsPythonHugging Face Transformersnewspaper/requests
What you'll learn
- âExtractive vs abstractive summarisation
- âUsing pretrained seq2seq models
- âROUGE evaluation
What you'll build
- âSummarise pasted text or a URL
- âExtractive (TextRank-style) summary
- âAbstractive summary with a pretrained model
- âLength slider
Step-by-step guide
- 1
Get text
For URLs, fetch with requests and extract the main text (for example with trafilatura).
- 2
Extractive
Split into sentences, score them by word frequency or TextRank (networkx pagerank on a sentence similarity graph), keep the top N in order.
- 3
Abstractive
pipeline("summarization", model="facebook/bart-large-cnn") or a smaller model; respect the input length limit by chunking.
- 4
Long articles
Summarise chunks, then summarise the summaries.
- 5
Evaluate
Use a dataset with reference summaries (CNN/DailyMail) and compute ROUGE with the evaluate library.
- 6
UI
Gradio or Streamlit with both summaries side by side.
- 7
Be careful
Show the source link; summaries can be wrong, so say so.
đ Make it stand out
- +Summarise Hindi news with a multilingual model
- +Bullet-point mode
- +Daily email digest