Wootang01 commited on
Commit
679333b
·
1 Parent(s): 1669e40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1,7 +1,14 @@
1
  import gradio as gr
 
2
 
3
- def question_answer(context, question):
4
- # Implement Q&A model here...
5
- # Return a tuple consisting of two strings: (answer, confidence)
6
 
7
- iface = gr.Interface(fn=question_answer, inputs=["text", "text"], outputs=["textbox", "text"]).launch()
 
 
 
 
 
 
 
 
 
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()