Spaces:
Sleeping
Sleeping
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() |