import gradio as gr from knowledge_base import PNAKnowledgeBase from pna_client import PNAAssistantClient # --- Constants --- GUIDE_FILENAME = "Professional nurse advocate A-EQUIP model Guide.md" # --- Initialize Components --- kb = PNAKnowledgeBase(GUIDE_FILENAME) client = PNAAssistantClient() def chat_response(message, history): """Generate response using RAG + fine-tuned model.""" # Search Knowledge Base for relevant context context = kb.search(message) # Generate Response using fine-tuned MedGemma response = client.generate_response(message, context=context, history=history) return response # --- Premium CSS --- CUSTOM_CSS = """ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@600;700&display=swap'); .gradio-container { max-width: 800px !important; margin: 0 auto !important; font-family: 'Inter', sans-serif !important; } .contain { background: linear-gradient(135deg, #4f46e5 0%, #0d9488 100%) !important; } footer { display: none !important; } """ HEADER_HTML = """

Professional Nurse Advocate Assistant

Guiding you through the A-EQUIP model and Restorative Supervision

👨🏾‍⚕️ 👩🏽‍⚕️ 👨🏿‍⚕️ 👩🏻‍⚕️ 👩‍⚕️
""" DISCLAIMER_HTML = """
⚠️ This tool is for educational purposes only. It does not provide clinical advice.
""" # --- Simple ChatInterface --- with gr.Blocks(css=CUSTOM_CSS, title="PNA Assistant") as demo: gr.HTML(HEADER_HTML) gr.ChatInterface( fn=chat_response, type="messages", examples=[ "What is the A-EQUIP model?", "Explain the four functions of clinical supervision", "How can I support a colleague through restorative supervision?", "What does a Professional Nurse Advocate do?" ], title="", ) gr.HTML(DISCLAIMER_HTML) if __name__ == "__main__": demo.launch()