Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,10 +54,21 @@ st.markdown("""
|
|
| 54 |
width: 100%;
|
| 55 |
border-radius: 8px;
|
| 56 |
font-weight: 600;
|
| 57 |
-
margin-bottom: 6px;
|
| 58 |
}
|
| 59 |
|
| 60 |
-
/* 3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
:root {
|
| 62 |
--primary-color: #1e3a8a;
|
| 63 |
--background-color: #0e1117;
|
|
@@ -92,7 +103,7 @@ st.markdown("""
|
|
| 92 |
padding-top: 5px;
|
| 93 |
}
|
| 94 |
|
| 95 |
-
/*
|
| 96 |
.title-container {
|
| 97 |
text-align: center;
|
| 98 |
margin-bottom: 20px;
|
|
@@ -113,7 +124,7 @@ st.markdown("""
|
|
| 113 |
text-decoration: none;
|
| 114 |
}
|
| 115 |
|
| 116 |
-
/*
|
| 117 |
[data-testid="stForm"] {
|
| 118 |
border: none;
|
| 119 |
padding: 0;
|
|
@@ -242,10 +253,9 @@ st.markdown("""
|
|
| 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 |
-
#
|
| 249 |
if st.button("🗑️ Clear Chat History", use_container_width=True):
|
| 250 |
clear_chat_history()
|
| 251 |
|
|
@@ -254,18 +264,21 @@ with st.sidebar:
|
|
| 254 |
|
| 255 |
st.markdown("---")
|
| 256 |
|
| 257 |
-
#
|
|
|
|
|
|
|
|
|
|
| 258 |
uploaded = st.file_uploader(
|
| 259 |
-
|
| 260 |
type=["pdf"],
|
| 261 |
key=st.session_state.uploader_key,
|
| 262 |
-
label_visibility="collapsed" #
|
| 263 |
)
|
| 264 |
|
| 265 |
-
# Status Message
|
| 266 |
if uploaded:
|
| 267 |
if uploaded.name != st.session_state.uploaded_file_name:
|
| 268 |
-
# Processing
|
| 269 |
st.session_state.uploaded_file_name = None
|
| 270 |
st.session_state.chat = []
|
| 271 |
|
|
@@ -278,10 +291,10 @@ with st.sidebar:
|
|
| 278 |
else:
|
| 279 |
st.error("❌ Failed.")
|
| 280 |
else:
|
| 281 |
-
#
|
| 282 |
-
|
|
|
|
| 283 |
else:
|
| 284 |
-
# No file uploaded yet
|
| 285 |
st.warning("⬆️ Upload a PDF to start chatting!")
|
| 286 |
|
| 287 |
# ---------------- INPUT AREA ----------------
|
|
|
|
| 54 |
width: 100%;
|
| 55 |
border-radius: 8px;
|
| 56 |
font-weight: 600;
|
| 57 |
+
margin-bottom: 6px;
|
| 58 |
}
|
| 59 |
|
| 60 |
+
/* 3. HIDE UPLOADED FILE LIST BELOW UPLOADER */
|
| 61 |
+
/* This specifically hides the list of file names that appears below the browse button */
|
| 62 |
+
section[data-testid="stFileUploader"] ul {
|
| 63 |
+
display: none;
|
| 64 |
+
}
|
| 65 |
+
/* Also hide the small 'Limit 200MB' text if desired, optional:
|
| 66 |
+
section[data-testid="stFileUploader"] small {
|
| 67 |
+
display: none;
|
| 68 |
+
}
|
| 69 |
+
*/
|
| 70 |
+
|
| 71 |
+
/* 4. CHAT & UI STYLING */
|
| 72 |
:root {
|
| 73 |
--primary-color: #1e3a8a;
|
| 74 |
--background-color: #0e1117;
|
|
|
|
| 103 |
padding-top: 5px;
|
| 104 |
}
|
| 105 |
|
| 106 |
+
/* 5. CENTER TITLE STYLING */
|
| 107 |
.title-container {
|
| 108 |
text-align: center;
|
| 109 |
margin-bottom: 20px;
|
|
|
|
| 124 |
text-decoration: none;
|
| 125 |
}
|
| 126 |
|
| 127 |
+
/* 6. INPUT FORM STYLING */
|
| 128 |
[data-testid="stForm"] {
|
| 129 |
border: none;
|
| 130 |
padding: 0;
|
|
|
|
| 253 |
|
| 254 |
# ---------------- SIDEBAR ----------------
|
| 255 |
with st.sidebar:
|
|
|
|
| 256 |
st.write("")
|
| 257 |
|
| 258 |
+
# Action Buttons
|
| 259 |
if st.button("🗑️ Clear Chat History", use_container_width=True):
|
| 260 |
clear_chat_history()
|
| 261 |
|
|
|
|
| 264 |
|
| 265 |
st.markdown("---")
|
| 266 |
|
| 267 |
+
# Dynamic Label based on state
|
| 268 |
+
# If a file is loaded, show a success icon/text. If not, show "Upload PDF".
|
| 269 |
+
upload_label = "✅ PDF Uploaded!" if st.session_state.uploaded_file_name else "Upload PDF"
|
| 270 |
+
|
| 271 |
uploaded = st.file_uploader(
|
| 272 |
+
upload_label,
|
| 273 |
type=["pdf"],
|
| 274 |
key=st.session_state.uploader_key,
|
| 275 |
+
label_visibility="collapsed" # Still hiding the main label text
|
| 276 |
)
|
| 277 |
|
| 278 |
+
# Status Message logic
|
| 279 |
if uploaded:
|
| 280 |
if uploaded.name != st.session_state.uploaded_file_name:
|
| 281 |
+
# Processing
|
| 282 |
st.session_state.uploaded_file_name = None
|
| 283 |
st.session_state.chat = []
|
| 284 |
|
|
|
|
| 291 |
else:
|
| 292 |
st.error("❌ Failed.")
|
| 293 |
else:
|
| 294 |
+
# Active State
|
| 295 |
+
# This appears BELOW the uploader box
|
| 296 |
+
st.success(f"👍 **Ready:** `{uploaded.name}`")
|
| 297 |
else:
|
|
|
|
| 298 |
st.warning("⬆️ Upload a PDF to start chatting!")
|
| 299 |
|
| 300 |
# ---------------- INPUT AREA ----------------
|