import streamlit as st from rag_query import query_rag # Custom CSS for styling st.markdown(""" """, unsafe_allow_html=True) # Initialize session state for password if "authenticated" not in st.session_state: st.session_state.authenticated = False # Main app title (shown on all screens) st.title("United Methodist Church Discipline Assistant") st.write("Ask questions about The Book of Discipline 2020-2024!") # Password form (shown only if not authenticated) if not st.session_state.authenticated: with st.form(key="password_form"): password = st.text_input("Enter password:", type="password", key="password") submit_password = st.form_submit_button("Login") if submit_password: if password == "umc2025": # Password as set st.session_state.authenticated = True st.rerun() # Refresh to show main app else: st.error("Incorrect password. Please try again.") # Main app content (shown only if authenticated) if st.session_state.authenticated: # Interactive input with sample questions sample_questions = [ "Can you tell me the history of United Methodist Church", "What does the Constitution say about inclusiveness?", "Tell me about John Wesley." ] query = st.selectbox("Pick a question or type your own:", [""] + sample_questions, key="query_select") or st.text_input("Your question:", key="query_input") # Process query and display response if st.button("Submit"): with st.spinner("Fetching response..."): response = query_rag(query) st.markdown(response) # Sidebar with logo, text, and instructions (always shown) st.sidebar.image("UMC_Logo.png", width=200) # Adjusted logo size for sidebar st.sidebar.markdown('
United Methodist Communications
', unsafe_allow_html=True) st.sidebar.markdown('', unsafe_allow_html=True) # Add space st.sidebar.header("Instructions") st.sidebar.write("Enter a question about The United Methodist Church's Book of Discipline. The assistant will retrieve relevant sections and explain them in simple language, citing parts, paragraphs, and titles as needed.") st.sidebar.header("About") st.sidebar.write("Powered by United Methodist Communications.")