Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import
|
3 |
-
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
import torch
|
4 |
+
|
5 |
+
def answer_question(question, answer_text):
|
6 |
+
model_checkpoint = "MarcBrun/ixambert-finetuned-squad"
|
7 |
+
question_answerer = pipeline("question-answering", model=model_checkpoint)
|
8 |
+
|
9 |
+
answer = question_answerer(question=question, context=context)
|
10 |
+
|
11 |
+
return answer["answer"]
|
12 |
+
|
13 |
+
iface = gr.Interface(fn=answer_question, inputs=[gr.inputs.Textbox(lines=1, placeholder="Question Here...", label="Question"),gr.inputs.Textbox(lines=5, placeholder="Context Here...", label="Context")], outputs="text")
|
14 |
+
iface.launch()
|