MaawaKhalid's picture
Update app.py
d00f8b0 verified
raw
history blame contribute delete
659 Bytes
import gradio as gr
from transformers import pipeline
# Load your QA model
qa_pipeline = pipeline('question-answering', model='MaawaKhalid/Extractive-QA-Bot')
# Define a function to handle the QA
def qa_function(context, question):
result = qa_pipeline({'context': context, 'question': question})
return result['answer']
# Create a Gradio interface
gr.Interface(
fn=qa_function,
inputs=[
gr.components.Textbox(label="Context", placeholder="Enter some text to ask questions from"),
gr.components.Textbox(label="Question", placeholder="Enter your question")
],
outputs=gr.components.Textbox(label="Answer")
).launch()