IniziaInizia gratis

Summarizing news articles for quick insights

A news aggregation app needs to provide users with concise summaries of lengthy news articles so they can quickly grasp the main points without reading the entire text. Your task is to use a Hugging Face pipeline to generate clear, brief summaries from full news articles.

Questo esercizio fa parte del corso

Natural Language Processing (NLP) in Python

Visualizza il corso

Istruzioni dell'esercizio

  • Create a summarizer pipeline using the "cnicu/t5-small-booksum" model.
  • Summarize the given article text.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

from transformers import pipeline

# Create the summarization pipeline
summarizer = pipeline(task="____", model="____")

article = """NASA's Perseverance rover has successfully collected its first rock samples from Mars, marking a significant milestone in the mission. The samples will be stored for potential return to Earth in the future, providing valuable insight into the planet's geology and potential signs of past microbial life."""

# Generate the summary
summary = ____

print(summary)
Modifica ed esegui il codice