Untitled
!pip install gradio transformers import gradio as gr from transformers import pipeline qa_pipeline = pipeline("question-answering",model="distilbert-base-cased-distilled-squad") def question_answer(context, question): result = qa_pipeline(question=question, context=context) return result["answer"] # The issue was likely a typo in the function name called when creating the Gradio interface. # Changing "answer_question" to "question_answer" should fix the issue. interface = gr.Interface(fn=question_answer, inputs=["text", "text"], outputs="text") interface.launch()
Leave a Comment