import streamlit as st from retriever import load_vector_store from langgraph_graph import generate_answer from time import sleep # Load vector DB db = load_vector_store() st.set_page_config("MedMCQA Chatbot", page_icon="🩺") # 🌗 Theme toggle sidebar with st.sidebar: st.title("🩺 MedMCQA Chatbot") theme_mode = st.radio("🌓 Theme", ["Light", "Dark"], horizontal=True) # 🌓 Apply selected theme if theme_mode == "Dark": st.markdown(""" """, unsafe_allow_html=True) else: st.markdown(""" """, unsafe_allow_html=True) # 🧠 App title st.header("🩺 MedMCQA Chatbot") st.caption("Ask a medical question and get answers from the MedMCQA dataset only. If not found, it will respond gracefully.") # ✏️ Query box query = st.text_input( "🔍 Enter your medical question:", placeholder="e.g., What is the mechanism of Aspirin?", label_visibility="visible" ) # 🚀 Answer generation if query: results = db.similarity_search(query, k=3) context = "\n\n".join([doc.page_content for doc in results]) with st.spinner("🧠 Generating answer..."): response = generate_answer(query, context) st.markdown(""" """, unsafe_allow_html=True) st.markdown("
Made with ❤️ by Sanketh Honavar
""", unsafe_allow_html=True)