context-AI / app.py
rahul7star's picture
Update app.py
7b87d32 verified
raw
history blame contribute delete
431 Bytes
import gradio as gr
from transformers import pipeline
# Initialize the custom pipeline
qa_pipeline = pipeline("question-answering")
def answer_question(context, question):
result = qa_pipeline({'context': context, 'question': question})
return result['answer']
# Define the Gradio interface
interface = gr.Interface(fn=answer_question, inputs=["text", "text"], outputs="text")
# Launch the interface
interface.launch()