import gradio as gr from transformers import pipeline # Load the question-answering pipeline pipe = pipeline("question-answering", model="hagara/biobert-qa") # Define the interface def qa_interface(context, question): result = pipe(question=question, context=context) answer = result["answer"] return answer # Create the Gradio interface iface = gr.Interface( fn=qa_interface, inputs=["text", "text"], outputs="text", title="Medical Question-Answering Interface", description="Ask a question related to medical case", ) # Launch the interface iface.launch()