Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,12 +50,11 @@ st.markdown("""
|
|
| 50 |
}
|
| 51 |
|
| 52 |
/* 2. SIDEBAR BUTTON STYLING (Vertical & Uniform) */
|
| 53 |
-
/* Target buttons in the sidebar to ensure they look consistent */
|
| 54 |
[data-testid="stSidebar"] .stButton button {
|
| 55 |
width: 100%;
|
| 56 |
border-radius: 8px;
|
| 57 |
font-weight: 600;
|
| 58 |
-
margin-bottom:
|
| 59 |
}
|
| 60 |
|
| 61 |
/* 3. CHAT & UI STYLING */
|
|
@@ -220,7 +219,7 @@ FINAL ANSWER:
|
|
| 220 |
"content": "Use only the PDF content. If answer not found, say: 'I cannot find this in the PDF.'"},
|
| 221 |
{"role": "user", "content": prompt}
|
| 222 |
],
|
| 223 |
-
temperature=0.
|
| 224 |
)
|
| 225 |
|
| 226 |
answer = response.choices[0].message.content.strip()
|
|
@@ -241,14 +240,12 @@ st.markdown("""
|
|
| 241 |
</div>
|
| 242 |
""", unsafe_allow_html=True)
|
| 243 |
|
| 244 |
-
# ---------------- SIDEBAR
|
| 245 |
with st.sidebar:
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
# 1. Stacked Buttons (Vertical)
|
| 249 |
-
# We remove columns and place buttons sequentially.
|
| 250 |
-
# use_container_width=True ensures they stretch to fit the sidebar.
|
| 251 |
|
|
|
|
| 252 |
if st.button("🗑️ Clear Chat History", use_container_width=True):
|
| 253 |
clear_chat_history()
|
| 254 |
|
|
@@ -257,14 +254,15 @@ with st.sidebar:
|
|
| 257 |
|
| 258 |
st.markdown("---")
|
| 259 |
|
| 260 |
-
# File Upload
|
| 261 |
uploaded = st.file_uploader(
|
| 262 |
-
"Upload
|
| 263 |
type=["pdf"],
|
| 264 |
-
key=st.session_state.uploader_key
|
|
|
|
| 265 |
)
|
| 266 |
|
| 267 |
-
# Status Message
|
| 268 |
if uploaded:
|
| 269 |
if uploaded.name != st.session_state.uploaded_file_name:
|
| 270 |
# Processing logic
|
|
|
|
| 50 |
}
|
| 51 |
|
| 52 |
/* 2. SIDEBAR BUTTON STYLING (Vertical & Uniform) */
|
|
|
|
| 53 |
[data-testid="stSidebar"] .stButton button {
|
| 54 |
width: 100%;
|
| 55 |
border-radius: 8px;
|
| 56 |
font-weight: 600;
|
| 57 |
+
margin-bottom: 6px; /* Spacing between buttons */
|
| 58 |
}
|
| 59 |
|
| 60 |
/* 3. CHAT & UI STYLING */
|
|
|
|
| 219 |
"content": "Use only the PDF content. If answer not found, say: 'I cannot find this in the PDF.'"},
|
| 220 |
{"role": "user", "content": prompt}
|
| 221 |
],
|
| 222 |
+
temperature=0.0
|
| 223 |
)
|
| 224 |
|
| 225 |
answer = response.choices[0].message.content.strip()
|
|
|
|
| 240 |
</div>
|
| 241 |
""", unsafe_allow_html=True)
|
| 242 |
|
| 243 |
+
# ---------------- SIDEBAR ----------------
|
| 244 |
with st.sidebar:
|
| 245 |
+
# 1. Spacer to push content down slightly (optional, but looks better without header)
|
| 246 |
+
st.write("")
|
|
|
|
|
|
|
|
|
|
| 247 |
|
| 248 |
+
# 2. Action Buttons (No Header)
|
| 249 |
if st.button("🗑️ Clear Chat History", use_container_width=True):
|
| 250 |
clear_chat_history()
|
| 251 |
|
|
|
|
| 254 |
|
| 255 |
st.markdown("---")
|
| 256 |
|
| 257 |
+
# 3. File Upload (Label Hidden)
|
| 258 |
uploaded = st.file_uploader(
|
| 259 |
+
"Upload PDF", # Label is required but hidden via visibility param
|
| 260 |
type=["pdf"],
|
| 261 |
+
key=st.session_state.uploader_key,
|
| 262 |
+
label_visibility="collapsed" # <--- Hides the "Upload your PDF" text
|
| 263 |
)
|
| 264 |
|
| 265 |
+
# Status Message
|
| 266 |
if uploaded:
|
| 267 |
if uploaded.name != st.session_state.uploaded_file_name:
|
| 268 |
# Processing logic
|