from transformers import pipeline # Load the BioBERT model for question answering qa_pipeline = pipeline('question-answering', model='dmis-lab/biobert-base-cased-v1.1') # Example question and context 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. """ # Get the answer result = qa_pipeline(question=question, context=context) print(result['answer'])