Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -261,33 +261,220 @@ TERMS_OF_SERVICE_TEXT = load_markdown_text("terms_of_service.md")
|
|
| 261 |
# ---------------------- Sleek UI assets (CSS/JS only) ----------------------
|
| 262 |
|
| 263 |
SLEEK_CSS = """
|
| 264 |
-
/*
|
| 265 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
height: 100% !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
max-height: none !important;
|
|
|
|
|
|
|
|
|
|
| 268 |
}
|
| 269 |
|
| 270 |
-
|
| 271 |
-
|
|
|
|
|
|
|
| 272 |
max-height: none !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
}
|
| 274 |
|
| 275 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
overflow-y: auto !important;
|
| 277 |
overflow-x: hidden !important;
|
| 278 |
padding: 24px !important;
|
| 279 |
-
height:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
max-height: none !important;
|
| 281 |
}
|
| 282 |
|
| 283 |
/* Nice scrollbar */
|
| 284 |
-
#
|
| 285 |
width: 8px;
|
| 286 |
}
|
| 287 |
-
#
|
| 288 |
-
background:
|
|
|
|
|
|
|
|
|
|
| 289 |
border-radius: 4px;
|
| 290 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
"""
|
| 292 |
|
| 293 |
VOICE_STT_HTML = """
|
|
|
|
| 261 |
# ---------------------- Sleek UI assets (CSS/JS only) ----------------------
|
| 262 |
|
| 263 |
SLEEK_CSS = """
|
| 264 |
+
/* Full-bleed, modern look */
|
| 265 |
+
:root, body, #root, .gradio-container { height: 100%; }
|
| 266 |
+
.gradio-container { padding: 0 !important; }
|
| 267 |
+
.block { padding: 0 !important; }
|
| 268 |
+
|
| 269 |
+
/* Header */
|
| 270 |
+
.header {
|
| 271 |
+
padding: 20px 28px;
|
| 272 |
+
background: linear-gradient(135deg, #0e1726, #1d2a44 60%, #243a5e);
|
| 273 |
+
color: #fff;
|
| 274 |
+
display: flex; align-items: center; justify-content: space-between;
|
| 275 |
+
gap: 16px;
|
| 276 |
+
}
|
| 277 |
+
.header h1 { margin: 0; font-size: 22px; letter-spacing: 0.3px; font-weight: 600; }
|
| 278 |
+
.header .badge { font-size: 12px; opacity: 0.9; background:#ffffff22; padding:6px 10px; border-radius: 999px; }
|
| 279 |
+
|
| 280 |
+
/* Main layout */
|
| 281 |
+
.main {
|
| 282 |
+
display: grid;
|
| 283 |
+
grid-template-columns: 420px 1fr;
|
| 284 |
+
gap: 16px;
|
| 285 |
+
padding: 16px;
|
| 286 |
+
height: calc(100vh - 72px);
|
| 287 |
+
box-sizing: border-box;
|
| 288 |
+
}
|
| 289 |
+
.left, .right {
|
| 290 |
+
background: #0b1020;
|
| 291 |
+
color: #e9edf3;
|
| 292 |
+
border-radius: 16px;
|
| 293 |
+
border: 1px solid #1c2642;
|
| 294 |
+
}
|
| 295 |
+
.left { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
|
| 296 |
+
.right { padding: 0; display: flex; flex-direction: column; }
|
| 297 |
+
|
| 298 |
+
/* Panels */
|
| 299 |
+
.panel-title { font-size: 14px; font-weight: 600; color: #aeb8cc; margin-bottom: 6px; }
|
| 300 |
+
.helper { font-size: 12px; color: #97a3bb; margin-bottom: 8px; }
|
| 301 |
+
|
| 302 |
+
/* Sticky actions */
|
| 303 |
+
.actions {
|
| 304 |
+
display: flex; gap: 8px; align-items: center; justify-content: stretch;
|
| 305 |
+
}
|
| 306 |
+
.actions .gr-button { flex: 1; }
|
| 307 |
+
|
| 308 |
+
/* Tabs full height */
|
| 309 |
+
.right .tabs { height: 100%; display: flex; flex-direction: column; }
|
| 310 |
+
.right .tabitem { flex: 1; display: flex; flex-direction: column; }
|
| 311 |
+
#chatbot_container { flex: 1; }
|
| 312 |
+
#chatbot_container .gr-chatbot { height: 100%; }
|
| 313 |
+
|
| 314 |
+
/* Tiny separators */
|
| 315 |
+
.hr { height: 1px; background: #16203b; margin: 10px 0; }
|
| 316 |
+
|
| 317 |
+
/* Voice hint */
|
| 318 |
+
.voice-hint { font-size: 12px; color:#9fb0cc; margin-top: 4px; }
|
| 319 |
+
/* βββ MAKE ANALYSIS OUTPUT WINDOW MUCH TALLER & SCROLL-FRIENDLY βββ */
|
| 320 |
+
#chatbot_container {
|
| 321 |
+
flex: 1;
|
| 322 |
+
min-height: 0; /* Critical for proper flex shrinking */
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
#chatbot_container .gr-chatbot {
|
| 326 |
height: 100% !important;
|
| 327 |
+
max-height: none !important; /* Remove Gradio's artificial cap */
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
#chatbot_container .message-wrap {
|
| 331 |
+
max-width: 100% !important;
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
/* Make the actual message container take full height and scroll nicely */
|
| 335 |
+
#chatbot_container .chatbot {
|
| 336 |
+
overflow-y: auto !important;
|
| 337 |
+
overflow-x: hidden;
|
| 338 |
+
padding: 20px !important;
|
| 339 |
+
scrollbar-width: thin;
|
| 340 |
+
scrollbar-color: #3a4a6e #16203b;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
/* Optional: nicer scrollbar for WebKit browsers */
|
| 344 |
+
#chatbot_container .chatbot::-webkit-scrollbar {
|
| 345 |
+
width: 8px;
|
| 346 |
+
}
|
| 347 |
+
#chatbot_container .chatbot::-webkit-scrollbar-track {
|
| 348 |
+
background: #16203b;
|
| 349 |
+
}
|
| 350 |
+
#chatbot_container .chatbot::-webkit-scrollbar-thumb {
|
| 351 |
+
background: #3a4a6e;
|
| 352 |
+
border-radius: 4px;
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
/* Make markdown content more readable in long reports */
|
| 356 |
+
#chatbot_container .message pre {
|
| 357 |
+
overflow-x: auto;
|
| 358 |
+
background: #0f1629 !important;
|
| 359 |
+
border: 1px solid #2a3755;
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
/* Increase visible height dramatically */
|
| 363 |
+
.main {
|
| 364 |
+
height: calc(100vh - 72px) !important; /* Already good */
|
| 365 |
+
padding: 12px 16px; /* Slightly less padding = more space */
|
| 366 |
+
}
|
| 367 |
+
/* βββ EXPANDED ANALYSIS OUTPUT WINDOW βββ */
|
| 368 |
+
#chatbot_container { flex: 1; min-height: 0; }
|
| 369 |
+
#chatbot_container .gr-chatbot { height: 100% !important; max-height: none !important; }
|
| 370 |
+
#chatbot_container .chatbot {
|
| 371 |
+
overflow-y: auto !important;
|
| 372 |
+
padding: 20px !important;
|
| 373 |
+
scrollbar-width: thin;
|
| 374 |
+
scrollbar-color: #3a4a6e #16203b;
|
| 375 |
+
}
|
| 376 |
+
#chatbot_container .chatbot::-webkit-scrollbar { width: 8px; }
|
| 377 |
+
#chatbot_container .chatbot::-webkit-scrollbar-track { background: #16203b; }
|
| 378 |
+
#chatbot_container .chatbot::-webkit-scrollbar-thumb { background: #3a4a6e; border-radius: 4px; }
|
| 379 |
+
/* βββ CRITICAL FIX: Make Chatbot fill the entire right panel βββ */
|
| 380 |
+
#chatbot_container {
|
| 381 |
+
flex: 1 1 100% !important;
|
| 382 |
+
min-height: 0;
|
| 383 |
+
display: flex !important;
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
#chatbot_container > .wrap {
|
| 387 |
+
flex: 1 !important;
|
| 388 |
+
display: flex !important;
|
| 389 |
+
flex-direction: column !important;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
/* This is the actual scrolling message area */
|
| 393 |
+
#chatbot_container .chatbot {
|
| 394 |
+
flex: 1 !important;
|
| 395 |
+
min-height: 0 !important;
|
| 396 |
max-height: none !important;
|
| 397 |
+
overflow-y: auto !important;
|
| 398 |
+
overflow-x: hidden !important;
|
| 399 |
+
padding: 24px !important;
|
| 400 |
}
|
| 401 |
|
| 402 |
+
/* Remove Gradioβs default max-height caps */
|
| 403 |
+
#chatbot_container .gr-chatbot,
|
| 404 |
+
#chatbot_container .gr-prose,
|
| 405 |
+
#chatbot_container .message-wrap {
|
| 406 |
max-height: none !important;
|
| 407 |
+
height: 100% !important;
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
/* Optional: nicer scrollbar */
|
| 411 |
+
#chatbot_container .chatbot::-webkit-scrollbar {
|
| 412 |
+
width: 8px;
|
| 413 |
+
}
|
| 414 |
+
#chatbot_container .chatbot::-webkit-scrollbar-track {
|
| 415 |
+
background: transparent;
|
| 416 |
+
}
|
| 417 |
+
#chatbot_container .chatbot::-webkit-scrollbar-thumb {
|
| 418 |
+
background: rgba(100, 120, 160, 0.4);
|
| 419 |
+
border-radius: 4px;
|
| 420 |
+
}
|
| 421 |
+
#chatbot_container .chatbot::-webkit-scrollbar-thumb:hover {
|
| 422 |
+
background: rgba(100, 120, 160, 0.7);
|
| 423 |
+
}
|
| 424 |
+
/* ββββββββ FINAL WORKING FIX FOR GRADIO 4+ CHATBOT HEIGHT (2025) ββββββββ */
|
| 425 |
+
#chatbot_container {
|
| 426 |
+
flex: 1 !important;
|
| 427 |
+
min-height: 0;
|
| 428 |
+
display: flex !important;
|
| 429 |
+
flex-direction: column !important;
|
| 430 |
}
|
| 431 |
|
| 432 |
+
/* This is the real container that holds the messages in Gradio 4+ */
|
| 433 |
+
#chatbot_container .svelte-1cea1s5 {
|
| 434 |
+
flex: 1 !important;
|
| 435 |
+
min-height: 0 !important;
|
| 436 |
+
display: flex !important;
|
| 437 |
+
flex-direction: column !important;
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
/* The actual scrollable message area (this is the one that was hidden) */
|
| 441 |
+
#chatbot_container .messages {
|
| 442 |
+
flex: 1 !important;
|
| 443 |
overflow-y: auto !important;
|
| 444 |
overflow-x: hidden !important;
|
| 445 |
padding: 24px !important;
|
| 446 |
+
min-height: 0 !important;
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
/* Remove any max-height caps */
|
| 450 |
+
#chatbot_container .gr-chatbot,
|
| 451 |
+
#chatbot_container .svelte-1cea1s5,
|
| 452 |
+
#chatbot_container .messages,
|
| 453 |
+
#chatbot_container * {
|
| 454 |
max-height: none !important;
|
| 455 |
}
|
| 456 |
|
| 457 |
/* Nice scrollbar */
|
| 458 |
+
#chatbot_container .messages::-webkit-scrollbar {
|
| 459 |
width: 8px;
|
| 460 |
}
|
| 461 |
+
#chatbot_container .messages::-webkit-scrollbar-track {
|
| 462 |
+
background: transparent;
|
| 463 |
+
}
|
| 464 |
+
#chatbot_container .messages::-webkit-scrollbar-thumb {
|
| 465 |
+
background: rgba(100, 120, 160, 0.4);
|
| 466 |
border-radius: 4px;
|
| 467 |
}
|
| 468 |
+
#chatbot_container .messages::-webkit-scrollbar-thumb:hover {
|
| 469 |
+
background: rgba(100, 120, 160, 0.7);
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
/* Optional: make code blocks look better in long reports */
|
| 473 |
+
#chatbot_container pre {
|
| 474 |
+
background: #0f1629 !important;
|
| 475 |
+
border: 1px solid #2a3755 !important;
|
| 476 |
+
border-radius: 8px !important;
|
| 477 |
+
}
|
| 478 |
"""
|
| 479 |
|
| 480 |
VOICE_STT_HTML = """
|