File size: 3,456 Bytes
5d28b99
 
 
 
 
 
 
 
 
bbfac09
 
 
 
 
 
 
 
 
 
 
 
 
51c5735
bbfac09
0934099
 
 
 
 
 
 
 
 
bbfac09
5d28b99
 
 
bbfac09
 
 
 
5d28b99
bbfac09
 
 
0934099
 
 
bbfac09
 
0eacec0
 
5d28b99
6cf0f97
 
 
 
 
 
 
 
 
 
 
 
 
 
bbfac09
 
 
 
 
 
 
 
379dce1
bbfac09
 
5d28b99
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import streamlit as st
from rag_query import query_rag

# Custom CSS for styling
st.markdown("""
    <style>
    .main {background-color: #f5f5f5;}
    .stTextInput > div > div > input {border: 2px solid #4CAF50; border-radius: 5px;}
    .stSelectbox > div > div > select {border: 2px solid #4CAF50; border-radius: 5px;}
    .stButton > button {
        background-color: #333333; /* Dark grey */
        color: white;
        border-radius: 5px;
        border: none;
        padding: 10px 20px;
        font-size: 16px;
    }
    .stButton > button:hover {
        background-color: #4CAF50; /* Green on hover */
        color: white;
    }
    .umc-header {
        font-size: 68px; /* Increased font size for better proportionality */
        font-weight: bold;
        display: flex;
        align-items: center; /* Vertically center the text */
        height: 100%; /* Match the height of the logo column */
        margin: 0; /* Remove default margins */
        padding-left: 10px; /* Small padding for spacing */
    }
    .logo-container {
        display: flex;
        align-items: center; /* Vertically center the logo */
    }
    </style>
""", 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('<div class="logo-container">', unsafe_allow_html=True)
        st.image("UMC_Logo.png", width=400)  # Increased logo size
        st.markdown('</div>', unsafe_allow_html=True)
    with col2:
        st.markdown('<p class="umc-header">United Methodist Communications</p>', 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.")