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 # Header with logo and text if st.session_state.authenticated: col1, col2 = st.columns([1, 3]) with col1: st.markdown('
', unsafe_allow_html=True) st.image("UMC_Logo.png", width=400) # Increased logo size st.markdown('
', unsafe_allow_html=True) with col2: st.markdown('

United Methodist Communications

', unsafe_allow_html=True) st.title("United Methodist Church Discipline Assistant") st.write("Ask questions about The Book of Discipline 2020-2024, including its Constitution and history!") # 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) # 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 == "umc2024": # Set your password here st.session_state.authenticated = True st.rerun() # Refresh to show main app else: st.error("Incorrect password. Please try again.") # Sidebar with instructions st.sidebar.header("Instructions") st.sidebar.write("Enter a question about The United Methodist Church's Book of Discipline 2020-2024. 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.")