🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101

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. 1

    Get text

    For URLs, fetch with requests and extract the main text (for example with trafilatura).

  2. 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. 3

    Abstractive

    pipeline("summarization", model="facebook/bart-large-cnn") or a smaller model; respect the input length limit by chunking.

  4. 4

    Long articles

    Summarise chunks, then summarise the summaries.

  5. 5

    Evaluate

    Use a dataset with reference summaries (CNN/DailyMail) and compute ROUGE with the evaluate library.

  6. 6

    UI

    Gradio or Streamlit with both summaries side by side.

  7. 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