|
from transformers import pipeline |
|
|
|
|
|
qa_pipeline = pipeline('question-answering', model='dmis-lab/biobert-base-cased-v1.1') |
|
|
|
|
|
question = "What is the function of the heart?" |
|
context = """ |
|
The heart is a muscular organ in most animals, which pumps blood through the blood vessels of the circulatory system. |
|
The pumped blood carries oxygen and nutrients to the body, while carrying metabolic waste such as carbon dioxide to the lungs. |
|
""" |
|
|
|
|
|
result = qa_pipeline(question=question, context=context) |
|
print(result['answer']) |
|
|