Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,33 +36,55 @@ st.set_page_config(
|
|
| 36 |
page_icon="cspclogo.png"
|
| 37 |
)
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
st.markdown('''
|
| 53 |
-
|
| 54 |
|
| 55 |
-
st.markdown('''
|
| 56 |
-
|
| 57 |
|
| 58 |
-
st.markdown('''
|
| 59 |
-
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
# Store LLM generated responses
|
| 68 |
if "messages" not in st.session_state:
|
|
@@ -168,7 +190,7 @@ if prompt := st.chat_input(placeholder="Ask a question..."):
|
|
| 168 |
# Clear chat history function
|
| 169 |
def clear_chat_history():
|
| 170 |
# Clear chat messages (reset the assistant greeting)
|
| 171 |
-
st.session_state.messages = [{"role": "assistant", "content": "How may I
|
| 172 |
|
| 173 |
# Reinitialize the chain to clear any stored history (ensures it forgets previous user inputs)
|
| 174 |
st.session_state.chain = init_chain()
|
|
@@ -177,4 +199,7 @@ def clear_chat_history():
|
|
| 177 |
st.session_state.query_counter = 0
|
| 178 |
st.session_state.conversation_history = ""
|
| 179 |
|
| 180 |
-
st.sidebar.button('Clear Chat History', on_click=clear_chat_history
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
page_icon="cspclogo.png"
|
| 37 |
)
|
| 38 |
|
| 39 |
+
# Custom CSS for styling
|
| 40 |
+
st.markdown(
|
| 41 |
+
"""
|
| 42 |
+
<style>
|
| 43 |
+
# .main {background-color: #f4f4f4;}
|
| 44 |
+
.title {text-align: center; font-size: 30px; font-weight: bold; color: #ffffff;}
|
| 45 |
+
.subtitle {text-align: center; font-size: 18px; font-weight: bold; color: #dddddd;}
|
| 46 |
+
.category {font-size: 16px; font-weight: bold; color: #222;}
|
| 47 |
+
.details {font-size: 14px; color: #bbbbbb; margin-left: 25px; margin-top: -10px; margin-bottom: 5px;}
|
| 48 |
+
.details1 {font-size: 14px; color: #bbbbbb; margin-left: 25px; margin-top: -10px; margin-bottom: 10px;}
|
| 49 |
+
.team {text-align: center; font-size: 14px; font-weight: bold; color: #777; margin-top: 20px;}
|
| 50 |
+
.resources a {color: #0066cc; text-decoration: none; font-weight: bold;}
|
| 51 |
+
.resources a:hover {color: #003366;}
|
| 52 |
+
</style>
|
| 53 |
+
""",
|
| 54 |
+
unsafe_allow_html=True
|
| 55 |
+
)
|
| 56 |
|
| 57 |
+
with st.sidebar:
|
| 58 |
+
# App title
|
| 59 |
+
st.markdown('<p class="title">CSPC Conversational Agent</p>', unsafe_allow_html=True)
|
| 60 |
+
st.markdown('<p class="subtitle">Your go-to assistant for the Citizen’s Charter of CSPC!</p>', unsafe_allow_html=True)
|
| 61 |
+
|
| 62 |
+
# Categories
|
| 63 |
+
st.markdown('''✔️**About CSPC:**''')
|
| 64 |
+
st.markdown('<p class="details">History, Core Values, Mission and Vision</p>', unsafe_allow_html=True)
|
| 65 |
+
|
| 66 |
+
st.markdown('''✔️**Admission & Graduation:**''')
|
| 67 |
+
st.markdown('<p class="details">Apply, Requirements, Process, Graduation</p>', unsafe_allow_html=True)
|
| 68 |
|
| 69 |
+
st.markdown('''✔️**Student Services:**''')
|
| 70 |
+
st.markdown('<p class="details">Scholarships, Orgs, Facilities</p>', unsafe_allow_html=True)
|
| 71 |
|
| 72 |
+
st.markdown('''✔️**Academics:**''')
|
| 73 |
+
st.markdown('<p class="details">Degrees, Courses, Faculty</p>', unsafe_allow_html=True)
|
| 74 |
|
| 75 |
+
st.markdown('''✔️**Officials:**''')
|
| 76 |
+
st.markdown('<p class="details1">President, VPs, Deans, Admin</p>', unsafe_allow_html=True)
|
| 77 |
|
| 78 |
+
# Links to resources
|
| 79 |
+
st.markdown("### 🔗 Quick Access to Resources")
|
| 80 |
+
st.markdown(
|
| 81 |
+
"""
|
| 82 |
+
📄 [CSPC Citizen’s Charter](https://cspc.edu.ph/governance/citizens-charter/)
|
| 83 |
+
🏛️ [About CSPC](https://cspc.edu.ph/about/)
|
| 84 |
+
📋 [College Officials](https://cspc.edu.ph/college-officials/)
|
| 85 |
+
""",
|
| 86 |
+
unsafe_allow_html=True
|
| 87 |
+
)
|
| 88 |
|
| 89 |
# Store LLM generated responses
|
| 90 |
if "messages" not in st.session_state:
|
|
|
|
| 190 |
# Clear chat history function
|
| 191 |
def clear_chat_history():
|
| 192 |
# Clear chat messages (reset the assistant greeting)
|
| 193 |
+
st.session_state.messages = [{"role": "assistant", "content": "Hello! I am your Conversational Agent for the Citizens Charter of Camarines Sur Polytechnic Colleges (CSPC). How may I assist you today?"}]
|
| 194 |
|
| 195 |
# Reinitialize the chain to clear any stored history (ensures it forgets previous user inputs)
|
| 196 |
st.session_state.chain = init_chain()
|
|
|
|
| 199 |
st.session_state.query_counter = 0
|
| 200 |
st.session_state.conversation_history = ""
|
| 201 |
|
| 202 |
+
st.sidebar.button('Clear Chat History', on_click=clear_chat_history
|
| 203 |
+
|
| 204 |
+
# Footer
|
| 205 |
+
st.sidebar.markdown('<p class="team">Developed by Team XceptionNet</p>', unsafe_allow_html=True)
|