Spaces:
Sleeping
Sleeping
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() | |