BaşlayınÜcretsiz Başlayın

Answering questions from product descriptions

An online retailer wants to improve its customer support by automatically answering common questions about products using their descriptions. Your task is to use a Hugging Face pipeline to extract precise answers from a product description based on customer queries.

Bu egzersiz

Natural Language Processing (NLP) in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a qa_pipeline using the "distilbert/distilbert-base-cased-distilled-squad" model for question answering.
  • Use the provided context (product description) and question to get an answer.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

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)
Kodu Düzenle ve Çalıştır