Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import tempfile
|
| 3 |
import gc
|
|
@@ -30,12 +32,7 @@ else:
|
|
| 30 |
st.warning("โ ๏ธ GROQ_API_KEY not found. Please add it to Hugging Face secrets.")
|
| 31 |
|
| 32 |
# ---------------- STREAMLIT UI SETUP ----------------
|
| 33 |
-
st.set_page_config(
|
| 34 |
-
page_title="PDF Assistant",
|
| 35 |
-
page_icon="๐",
|
| 36 |
-
layout="wide",
|
| 37 |
-
initial_sidebar_state="expanded" # <--- FIXED: Forces sidebar open on load
|
| 38 |
-
)
|
| 39 |
|
| 40 |
# ---------------- CSS ----------------
|
| 41 |
st.markdown("""
|
|
@@ -62,8 +59,6 @@ footer {
|
|
| 62 |
width: 20rem;
|
| 63 |
overflow-y: auto !important;
|
| 64 |
z-index: 99999;
|
| 65 |
-
background-color: #262730; /* <--- FIXED: Added background color so it is visible */
|
| 66 |
-
padding-top: 2rem;
|
| 67 |
}
|
| 68 |
[data-testid="stSidebar"]::-webkit-scrollbar {
|
| 69 |
width: 6px;
|
|
@@ -138,6 +133,10 @@ section[data-testid="stFileUploader"] small {
|
|
| 138 |
text-align: left;
|
| 139 |
color: #ffffff;
|
| 140 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
/* 9. TITLE TEXT */
|
| 142 |
.title-text {
|
| 143 |
font-size: 2.5rem;
|
|
@@ -270,7 +269,7 @@ with st.sidebar:
|
|
| 270 |
if st.button("๐๏ธ Clear Chat History", use_container_width=True):
|
| 271 |
clear_chat_history()
|
| 272 |
if st.button("๐ฅ Clear PDF Memory", on_click=clear_memory, use_container_width=True):
|
| 273 |
-
|
| 274 |
|
| 275 |
st.markdown("---")
|
| 276 |
|
|
@@ -316,6 +315,7 @@ if submit_btn and user_question:
|
|
| 316 |
with st.spinner("Thinking..."):
|
| 317 |
answer, sources, error = ask_question(user_question)
|
| 318 |
if answer:
|
|
|
|
| 319 |
bot_msg = answer
|
| 320 |
st.session_state.chat.append(("bot", bot_msg))
|
| 321 |
else:
|
|
@@ -329,4 +329,5 @@ if st.session_state.chat:
|
|
| 329 |
if role == "user":
|
| 330 |
st.markdown(f"<div class='chat-user'>{msg}</div>", unsafe_allow_html=True)
|
| 331 |
else:
|
| 332 |
-
st.markdown(f"<div class='chat-bot'>{msg}</div>", unsafe_allow_html=True)
|
|
|
|
|
|
| 1 |
+
I am not able to see left sidebar, why?
|
| 2 |
+
|
| 3 |
import os
|
| 4 |
import tempfile
|
| 5 |
import gc
|
|
|
|
| 32 |
st.warning("โ ๏ธ GROQ_API_KEY not found. Please add it to Hugging Face secrets.")
|
| 33 |
|
| 34 |
# ---------------- STREAMLIT UI SETUP ----------------
|
| 35 |
+
st.set_page_config(page_title="PDF Assistant", page_icon="๐", layout="wide")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# ---------------- CSS ----------------
|
| 38 |
st.markdown("""
|
|
|
|
| 59 |
width: 20rem;
|
| 60 |
overflow-y: auto !important;
|
| 61 |
z-index: 99999;
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
[data-testid="stSidebar"]::-webkit-scrollbar {
|
| 64 |
width: 6px;
|
|
|
|
| 133 |
text-align: left;
|
| 134 |
color: #ffffff;
|
| 135 |
}
|
| 136 |
+
/* Sources CSS removed/hidden as it is no longer used */
|
| 137 |
+
.sources {
|
| 138 |
+
display: none;
|
| 139 |
+
}
|
| 140 |
/* 9. TITLE TEXT */
|
| 141 |
.title-text {
|
| 142 |
font-size: 2.5rem;
|
|
|
|
| 269 |
if st.button("๐๏ธ Clear Chat History", use_container_width=True):
|
| 270 |
clear_chat_history()
|
| 271 |
if st.button("๐ฅ Clear PDF Memory", on_click=clear_memory, use_container_width=True):
|
| 272 |
+
st.success("Memory Cleared!")
|
| 273 |
|
| 274 |
st.markdown("---")
|
| 275 |
|
|
|
|
| 315 |
with st.spinner("Thinking..."):
|
| 316 |
answer, sources, error = ask_question(user_question)
|
| 317 |
if answer:
|
| 318 |
+
# CHANGED: Removed the 'Context Chunks Used' HTML from the message
|
| 319 |
bot_msg = answer
|
| 320 |
st.session_state.chat.append(("bot", bot_msg))
|
| 321 |
else:
|
|
|
|
| 329 |
if role == "user":
|
| 330 |
st.markdown(f"<div class='chat-user'>{msg}</div>", unsafe_allow_html=True)
|
| 331 |
else:
|
| 332 |
+
st.markdown(f"<div class='chat-bot'>{msg}</div>", unsafe_allow_html=True)
|
| 333 |
+
#check
|