Obotu commited on
Commit
1170e93
1 Parent(s): ba3c158

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
+ # Load the BioBERT model for question answering
4
+ qa_pipeline = pipeline('question-answering', model='dmis-lab/biobert-base-cased-v1.1')
5
+
6
+ # Example question and context
7
+ question = "What is the function of the heart?"
8
+ context = """
9
+ The heart is a muscular organ in most animals, which pumps blood through the blood vessels of the circulatory system.
10
+ The pumped blood carries oxygen and nutrients to the body, while carrying metabolic waste such as carbon dioxide to the lungs.
11
+ """
12
+
13
+ # Get the answer
14
+ result = qa_pipeline(question=question, context=context)
15
+ print(result['answer'])