File size: 463 Bytes
cf62fa5
9999a2d
b408543
 
 
9999a2d
01d57f1
b408543
 
cf62fa5
65c0dd1
1
2
3
4
5
6
7
8
9
10
11
import gradio as gr
import constants
from transformers import pipeline

question_answerer = pipeline("question-answering", model=constants.MODEL_NAME)

def question_answer(context, question):
    result = question_answerer(question=question, context=context)
    return result['answer'],result['score']

gr.Interface(fn=question_answer, inputs=["text", "text"], outputs=[gr.components.Textbox(label="Answer"), gr.components.Textbox(label="Probability")]).launch()