시작하기무료로 시작하기

제품 설명에서 질문에 답하기

한 온라인 소매업체가 제품 설명을 기반으로 고객의 일반적인 질문에 자동으로 답변해 고객 지원을 개선하려고 합니다. 여러분의 과제는 Hugging Face 파이프라인을 사용해 고객 문의에 따라 제품 설명에서 정확한 답을 추출하는 것입니다.

이 연습은 강의의 일부입니다

Python으로 배우는 Natural Language Processing (NLP)

강의 보기

연습 안내

  • 질문 답변을 위해 "distilbert/distilbert-base-cased-distilled-squad" 모델로 qa_pipeline을 생성하세요.
  • 제공된 context(제품 설명)와 question을 사용해 답변을 얻으세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

from transformers import pipeline

# Create the question-answering pipeline
qa_pipeline = pipeline(
    task="____",
    model="____"
)

context = """This smartphone features a 6.5-inch OLED display, 128GB of storage, and a 48MP camera with night mode. It supports 5G connectivity and has a battery life of up to 24 hours."""

question = "What is the size of the smartphone's display?"

# Get the answer
result = ____
print(result)
코드 편집 및 실행