Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,14 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
# Implement Q&A model here...
|
5 |
-
# Return a tuple consisting of two strings: (answer, confidence)
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from bert import QA
|
3 |
|
4 |
+
model = QA('bert-large-uncased-whole-word-masking-finetuned-squad')
|
|
|
|
|
5 |
|
6 |
+
def qa_func(context, question):
|
7 |
+
return model.predict(context, question)["answer"]
|
8 |
+
|
9 |
+
gr.Interface(qa_func,
|
10 |
+
[
|
11 |
+
gr.inputs.Textbox(lines=7, label="Paragraph"),
|
12 |
+
gr.inputs.Textbox(label="Question"),
|
13 |
+
],
|
14 |
+
gr.outputs.Textbox(label="Answer")).launch()
|