Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
qa_pipeline = pipeline("question-answering", model="deepset/roberta-base-squad2")
|
| 7 |
|
| 8 |
-
|
|
|
|
| 9 |
context = """
|
| 10 |
Washington, D.C. is the capital of the United States of America.
|
| 11 |
New Delhi is the capital of India.
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Load the QA model only once at the start
|
| 5 |
+
qa_pipeline = pipeline("question-answering", model="deepset/roberta-base-squad2")
|
|
|
|
| 6 |
|
| 7 |
+
def get_answer(question):
|
| 8 |
+
# Predefined factual context
|
| 9 |
context = """
|
| 10 |
Washington, D.C. is the capital of the United States of America.
|
| 11 |
New Delhi is the capital of India.
|