빠른 인사이트를 위한 뉴스 기사 요약
뉴스 모음 앱에서는 사용자가 긴 기사를 전부 읽지 않고도 핵심을 빠르게 파악할 수 있도록, 간결한 요약을 제공해야 합니다. Hugging Face 파이프라인을 사용해 전체 뉴스 기사에서 명확하고 짧은 요약을 생성하세요.
이 연습은 강의의 일부입니다
Python으로 배우는 Natural Language Processing (NLP)
연습 안내
"cnicu/t5-small-booksum"모델로summarizer파이프라인을 만드세요.- 주어진
article텍스트를 요약하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
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)