Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
-
|
4 |
-
|
5 |
def question_answer(context, question):
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
"context": context,
|
11 |
-
"qas": [
|
12 |
{
|
13 |
-
"
|
14 |
-
"
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
17 |
}
|
18 |
]
|
19 |
answers, probabilities = model.predict(to_predict)
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
+
|
|
|
4 |
def question_answer(context, question):
|
5 |
+
model_checkpoint = "huggingface-course/bert-finetuned-squad"
|
6 |
+
model = pipeline("question-answering", model=model_checkpoint)
|
7 |
+
|
8 |
+
to_predict = [
|
|
|
|
|
9 |
{
|
10 |
+
"context": context,
|
11 |
+
"qas": [
|
12 |
+
{
|
13 |
+
"question": question,
|
14 |
+
"id": "0",
|
15 |
+
}
|
16 |
+
],
|
17 |
}
|
18 |
]
|
19 |
answers, probabilities = model.predict(to_predict)
|