Introduction
Imagine you have a huge book but need a quick answer to a specific question. Searching through all the pages takes too long. Question answering systems solve this by finding the exact information you want quickly and clearly.
Jump into concepts and practice - no test required
Imagine asking a librarian a question in a huge library. The librarian listens carefully, quickly finds the right book and page, points out the exact sentence you need, and explains it clearly so you understand.
┌─────────────────────┐ │ 1. Understand Question │ └──────────┬──────────┘ │ ↓ ┌─────────────────────┐ │ 2. Search Information │ └──────────┬──────────┘ │ ↓ ┌─────────────────────┐ │ 3. Extract Answer │ └──────────┬──────────┘ │ ↓ ┌─────────────────────┐ │ 4. Present Answer │ └─────────────────────┘
from transformers import pipeline
qa = pipeline('question-answering')
context = "The Eiffel Tower is in Paris."
question = "Where is the Eiffel Tower located?"
result = qa(question=question, context=context)
print(result['answer'])
What will be printed?from transformers import pipeline
qa = pipeline('question-answering')
context = "Python is a programming language."
question = "What is Python?"
result = qa(question, context)
print(result['answer'])
What is the error and how to fix it?