Spaces:
Sleeping
Sleeping
File size: 431 Bytes
01eb127 7b87d32 01eb127 7b87d32 01eb127 7b87d32 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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()
|