9wimu9's picture
Update app.py
65c0dd1
raw
history blame
463 Bytes
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()