Spaces:
Sleeping
Sleeping
Moved CSS
Browse filesThe CSS was moved to its own file. The style sheet has been linked to
app.py
CHANGED
|
@@ -222,228 +222,6 @@ def respond_with_enhanced_streaming(message, history):
|
|
| 222 |
# UI CONFIGURATION SECTION - ALL UI RELATED CODE CENTRALIZED HERE
|
| 223 |
# ===============================================================================
|
| 224 |
|
| 225 |
-
# --- UI: Custom CSS Styles ---
|
| 226 |
-
custom_css = """
|
| 227 |
-
/* Import Oswald font - Google Fonts */
|
| 228 |
-
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap');
|
| 229 |
-
|
| 230 |
-
/* HIDE the HTML components that create scrollbars */
|
| 231 |
-
#component-1, #component-2, #component-3 {
|
| 232 |
-
display: none !important;
|
| 233 |
-
height: 0 !important;
|
| 234 |
-
min-height: 0 !important;
|
| 235 |
-
padding: 0 !important;
|
| 236 |
-
margin: 0 !important;
|
| 237 |
-
visibility: hidden !important;
|
| 238 |
-
}
|
| 239 |
-
|
| 240 |
-
}
|
| 241 |
-
|
| 242 |
-
/* Apply Oswald globally */
|
| 243 |
-
*, *::before, *::after {
|
| 244 |
-
font-family: "Oswald", sans-serif !important;
|
| 245 |
-
color: #120f0e !important;
|
| 246 |
-
}
|
| 247 |
-
|
| 248 |
-
.title-header {
|
| 249 |
-
background-color: rgb(240, 236, 230) !important;
|
| 250 |
-
padding: 10px 20px;
|
| 251 |
-
margin: 0 !important;
|
| 252 |
-
border-bottom: 1pt solid #59524f;
|
| 253 |
-
text-align: left;
|
| 254 |
-
flex-shrink: 0 !important;
|
| 255 |
-
height: 60px !important;
|
| 256 |
-
display: flex !important;
|
| 257 |
-
align-items: center !important;
|
| 258 |
-
width: 100% !important;
|
| 259 |
-
}
|
| 260 |
-
|
| 261 |
-
.title-header h1 {
|
| 262 |
-
font-size: 1.5rem;
|
| 263 |
-
font-weight: 600 !important;
|
| 264 |
-
color: #120f0e !important;
|
| 265 |
-
margin: 0;
|
| 266 |
-
padding: 0;
|
| 267 |
-
}
|
| 268 |
-
|
| 269 |
-
/* Input controls styling - acts as footer */
|
| 270 |
-
.input-controls {
|
| 271 |
-
padding: 15px 20px !important;
|
| 272 |
-
background-color: rgb(240, 236, 230) !important;
|
| 273 |
-
border-top: 1pt solid #59524f;
|
| 274 |
-
flex-shrink: 0 !important;
|
| 275 |
-
width: 100% !important;
|
| 276 |
-
}
|
| 277 |
-
|
| 278 |
-
/* Main container styling - viewport height with no top margin */
|
| 279 |
-
.gradio-container-5-42-0 {
|
| 280 |
-
background-color: rgb(240, 236, 230) !important;
|
| 281 |
-
font-family: "Oswald", sans-serif !important;
|
| 282 |
-
color: #120f0e !important;
|
| 283 |
-
padding: 0 !important;
|
| 284 |
-
margin: 0 !important;
|
| 285 |
-
height: 100vh !important;
|
| 286 |
-
max-height: 100vh !important;
|
| 287 |
-
overflow: hidden !important;
|
| 288 |
-
display: flex !important;
|
| 289 |
-
flex-direction: column !important;
|
| 290 |
-
}
|
| 291 |
-
|
| 292 |
-
/* Target Gradio's internal structure */
|
| 293 |
-
.gradio-container-5-42-0 > div {
|
| 294 |
-
height: 95% !important;
|
| 295 |
-
display: flex !important;
|
| 296 |
-
flex-direction: column !important;
|
| 297 |
-
padding-top: 0 !important;
|
| 298 |
-
margin-top: 0 !important;
|
| 299 |
-
}
|
| 300 |
-
|
| 301 |
-
/* Chat styling - FLEX to fill space */
|
| 302 |
-
.gradio-container-5-42-0 .gradio-chatbot {
|
| 303 |
-
background-color: #d9d1ce !important;
|
| 304 |
-
border: 1pt solid #59524f !important;
|
| 305 |
-
border-radius: 6px !important;
|
| 306 |
-
padding: 15px !important;
|
| 307 |
-
flex: 1 !important; /* Fill all remaining space */
|
| 308 |
-
min-height: 0 !important; /* Prevent overflow issues */
|
| 309 |
-
overflow-y: auto !important;
|
| 310 |
-
margin: 15px 20px !important;
|
| 311 |
-
}
|
| 312 |
-
|
| 313 |
-
/* Message styling */
|
| 314 |
-
.gradio-container-5-42-0 .gradio-chatbot .message.bot .markdown {
|
| 315 |
-
background-color: #f09c7d !important;
|
| 316 |
-
color: #120f0e !important;
|
| 317 |
-
border-radius: 8px !important;
|
| 318 |
-
padding: 12px 16px !important;
|
| 319 |
-
border: 1pt solid #59524f !important;
|
| 320 |
-
max-width: 70%;
|
| 321 |
-
margin-left: 0;
|
| 322 |
-
margin-right: auto;
|
| 323 |
-
word-wrap: break-word;
|
| 324 |
-
font-weight: 400 !important;
|
| 325 |
-
margin-bottom: 10px !important;
|
| 326 |
-
}
|
| 327 |
-
|
| 328 |
-
.gradio-container-5-42-0 .gradio-chatbot .message.user .markdown {
|
| 329 |
-
background-color: #a69189 !important;
|
| 330 |
-
color: #120f0e !important;
|
| 331 |
-
border-radius: 8px !important;
|
| 332 |
-
padding: 12px 16px !important;
|
| 333 |
-
border: 1pt solid #59524f !important;
|
| 334 |
-
max-width: 70%;
|
| 335 |
-
margin-left: auto;
|
| 336 |
-
margin-right: 0;
|
| 337 |
-
word-wrap: break-word;
|
| 338 |
-
font-weight: 400 !important;
|
| 339 |
-
margin-bottom: 10px !important;
|
| 340 |
-
}
|
| 341 |
-
|
| 342 |
-
/* Input controls styling */
|
| 343 |
-
.input-controls {
|
| 344 |
-
padding: 15px 20px !important;
|
| 345 |
-
background-color: rgb(240, 236, 230) !important;
|
| 346 |
-
border-top: 1pt solid #59524f;
|
| 347 |
-
flex-shrink: 0 !important;
|
| 348 |
-
}
|
| 349 |
-
|
| 350 |
-
.input-textbox textarea {
|
| 351 |
-
background-color: #f0ece6 !important;
|
| 352 |
-
border: 1pt solid #59524f !important;
|
| 353 |
-
border-radius: 6px !important;
|
| 354 |
-
color: #120f0e !important;
|
| 355 |
-
font-family: "Oswald", sans-serif !important;
|
| 356 |
-
padding: 10px !important;
|
| 357 |
-
resize: none !important;
|
| 358 |
-
}
|
| 359 |
-
|
| 360 |
-
.input-textbox textarea:focus {
|
| 361 |
-
border-color: #f09c7d !important;
|
| 362 |
-
box-shadow: 0 0 0 2px rgba(240, 156, 125, 0.2) !important;
|
| 363 |
-
}
|
| 364 |
-
|
| 365 |
-
.button-column {
|
| 366 |
-
margin-left: 10px !important;
|
| 367 |
-
min-width: 80px !important;
|
| 368 |
-
}
|
| 369 |
-
|
| 370 |
-
.send-button, .clear-button {
|
| 371 |
-
border: 1pt solid #59524f !important;
|
| 372 |
-
border-radius: 6px !important;
|
| 373 |
-
font-weight: 500 !important;
|
| 374 |
-
padding: 8px 16px !important;
|
| 375 |
-
margin-bottom: 5px !important;
|
| 376 |
-
width: 100% !important;
|
| 377 |
-
}
|
| 378 |
-
|
| 379 |
-
.send-button {
|
| 380 |
-
background-color: #f09c7d !important;
|
| 381 |
-
color: #120f0e !important;
|
| 382 |
-
}
|
| 383 |
-
|
| 384 |
-
.send-button:hover {
|
| 385 |
-
background-color: #e8895a !important;
|
| 386 |
-
border-color: #4a3f3c !important;
|
| 387 |
-
}
|
| 388 |
-
|
| 389 |
-
.clear-button {
|
| 390 |
-
background-color: #a69189 !important;
|
| 391 |
-
color: #120f0e !important;
|
| 392 |
-
}
|
| 393 |
-
|
| 394 |
-
.clear-button:hover {
|
| 395 |
-
background-color: #8f7d73 !important;
|
| 396 |
-
border-color: #4a3f3c !important;
|
| 397 |
-
}
|
| 398 |
-
|
| 399 |
-
/* Ensure Gradio footer is visible and properly positioned */
|
| 400 |
-
footer.svelte-czcr5b {
|
| 401 |
-
display: flex !important;
|
| 402 |
-
visibility: visible !important;
|
| 403 |
-
position: fixed !important;
|
| 404 |
-
bottom: 0 !important;
|
| 405 |
-
left: 0 !important;
|
| 406 |
-
right: 0 !important;
|
| 407 |
-
background-color: rgba(240, 236, 230, 0.95) !important;
|
| 408 |
-
backdrop-filter: blur(5px) !important;
|
| 409 |
-
border-top: 1pt solid #59524f !important;
|
| 410 |
-
padding: 8px 16px !important;
|
| 411 |
-
z-index: 1000 !important;
|
| 412 |
-
height: auto !important;
|
| 413 |
-
min-height: 40px !important;
|
| 414 |
-
}
|
| 415 |
-
|
| 416 |
-
/* Style the footer buttons to match your theme */
|
| 417 |
-
footer.svelte-czcr5b button {
|
| 418 |
-
background-color: transparent !important;
|
| 419 |
-
color: #120f0e !important;
|
| 420 |
-
border: none !important;
|
| 421 |
-
font-family: "Oswald", sans-serif !important;
|
| 422 |
-
font-size: 12px !important;
|
| 423 |
-
}
|
| 424 |
-
|
| 425 |
-
footer.svelte-czcr5b .divider {
|
| 426 |
-
color: #59524f !important;
|
| 427 |
-
}
|
| 428 |
-
|
| 429 |
-
/* Adjust main container to account for footer */
|
| 430 |
-
.main-container {
|
| 431 |
-
padding-bottom: 50px !important;
|
| 432 |
-
}
|
| 433 |
-
|
| 434 |
-
/* Responsive design */
|
| 435 |
-
@media (max-width: 768px) {
|
| 436 |
-
.gradio-container-5-42-0 .gradio-chatbot .message.bot .markdown,
|
| 437 |
-
.gradio-container-5-42-0 .gradio-chatbot .message.user .markdown {
|
| 438 |
-
max-width: 85%;
|
| 439 |
-
}
|
| 440 |
-
|
| 441 |
-
.input-controls {
|
| 442 |
-
padding: 10px !important;
|
| 443 |
-
}
|
| 444 |
-
}
|
| 445 |
-
"""
|
| 446 |
-
|
| 447 |
# --- UI: HTML Head Content ---
|
| 448 |
html_head_content = '''
|
| 449 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
@@ -523,7 +301,8 @@ def create_interface():
|
|
| 523 |
title="EduBot",
|
| 524 |
fill_width=True,
|
| 525 |
fill_height=True,
|
| 526 |
-
theme=gr.themes.
|
|
|
|
| 527 |
) as demo:
|
| 528 |
# Add head content and MathJax
|
| 529 |
gr.HTML(html_head_content)
|
|
|
|
| 222 |
# UI CONFIGURATION SECTION - ALL UI RELATED CODE CENTRALIZED HERE
|
| 223 |
# ===============================================================================
|
| 224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
# --- UI: HTML Head Content ---
|
| 226 |
html_head_content = '''
|
| 227 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
|
|
| 301 |
title="EduBot",
|
| 302 |
fill_width=True,
|
| 303 |
fill_height=True,
|
| 304 |
+
theme=gr.themes.Origin()
|
| 305 |
+
css="./styles.css"
|
| 306 |
) as demo:
|
| 307 |
# Add head content and MathJax
|
| 308 |
gr.HTML(html_head_content)
|