import gradio as gr | |
from transformers import pipeline | |
question_answerer = pipeline("question-answering", model="shashankheg/my_qa_model") | |
def QA(Question,Context): | |
result=question_answerer(question=Question, context=Context) | |
for answer in result: | |
return result['answer'] | |
interface = gr.Interface(fn =QA, | |
inputs = ['text','text'], | |
outputs=['text'], | |
title= 'Qustion Answering using Distilbert', | |
theme = gr.themes.Citrus(), | |
css = """" | |
body {background-color: #FFCCCB}""" | |
) | |
interface.launch() |