import gradio as gr from transformers import pipeline # Load QA pipelines (lightweight, free models) qa_model_1 = pipeline("question-answering", model="distilbert-base-cased-distilled-squad") qa_model_2 = pipeline("question-answering", model="deepset/tinyroberta-squad2") qa_model_3 = pipeline("question-answering", model="bert-base-uncased") def answer_question(question, context, model_choice): if model_choice == "🤖 DistilBERT": return qa_model_1(question=question, context=context)["answer"] elif model_choice == "🧠TinyRoBERTa": return qa_model_2(question=question, context=context)["answer"] elif model_choice == "📚 BERT Base": return qa_model_3(question=question, context=context)["answer"] with gr.Blocks() as demo: # Inject light orange background and dark orange bold heading via HTML gr.HTML("""