krrishD's picture
Upload with huggingface_hub
3f8695b
raw
history blame contribute delete
911 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("question-answering", model="vasudevgupta/bigbird-roberta-natural-questions")
def main(question, context):
answer = pipe(question=question, context=context)
return answer["answer"]
with gr.Blocks() as demo:
gr.Markdown("""# Question Answerer!""")
with gr.Row():
with gr.Column():
text1 = gr.Textbox(
label="Question",
lines=1,
value="Who does Cristiano Ronaldo play for?",
)
text2 = gr.Textbox(
label="Context",
lines=3,
value="Cristiano Ronaldo is a player for Manchester United",
)
output = gr.Textbox()
b1 = gr.Button("Ask Question!")
b1.click(main, inputs=[text1, text2], outputs=output)
gr.Markdown("""#### powered by [Tassle](https://bit.ly/3LXMklV)""")
if __name__ == "__main__":
demo.launch()