import gradio as gr from transformers import pipeline qa = pipeline("question-answering", model="distilbert-base-uncased-distilled-squad") def responder(contexto, pregunta): respuesta = qa(question=pregunta, context=contexto) return respuesta["answer"] app = gr.Interface( fn=responder, inputs=[gr.Textbox(label="Contexto"), gr.Textbox(label="Pregunta")], outputs="text" ) app.launch()