QA / app.py
makram's picture
Create app.py
868a964 verified
raw
history blame
626 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("question-answering", model="huggingface-course/bert-finetuned-squad")
def qa(question, answer):
return pipe(question=question, context=context)
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
question = gr.Textbox(label= 'Question')
context = gr.Textbox(label= 'Context')
submit_btn = gr.Button(value = 'Submit')
with gr.Column():
answer = gr.Textbox(label= 'Answer')
submit_btn.click(qa, inputs = [question, context], outputs = answer)
demo.launch()