Unverified Commit 9accbe53 authored by Nicolas Patry's avatar Nicolas Patry Committed by GitHub
Browse files

Adding doctest for `question-answering` pipeline. (#20259)

* Adding doctest for `question-answering` pipeline.

* Remove nested simplify.
parent d9efb36c
......@@ -226,6 +226,18 @@ class QuestionAnsweringPipeline(ChunkPipeline):
Question Answering pipeline using any `ModelForQuestionAnswering`. See the [question answering
examples](../task_summary#question-answering) for more information.
Example:
```python
>>> from transformers import pipeline
>>> oracle = pipeline(model="deepset/roberta-base-squad2")
>>> oracle(question="Where do I live?", context="My name is Wolfgang and I live in Berlin")
{'score': 0.9191, 'start': 34, 'end': 40, 'answer': 'Berlin'}
```
[Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial)
This question answering pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"question-answering"`.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment